IMGIITRoorkee / IMGIITRoorkee/placement-flutter

Fix assorted latent correctness defects

Open
#67 0 comments 0 reactions 0 assignees View on GitHub
bug P3
Dominant language
Dart
Stars
3
Forks
10
Avg merge
8d 21h
Merged PRs (30d)
4

Description

**Problem**

A set of small correctness defects found while auditing. None is individually urgent, but each is a latent crash or a silently wrong result, and several are the kind that only fire after an unrelated backend change.

- [ ] Two `??` defaults have the wrong type and are implicit downcasts that throw the moment the key is absent: `currentYear: json['student']['currentYear'] ?? "-"` assigns a `String` to an `int?` (`lib/models/candidateModel.dart:45`), and `requiresCoverLetter: json['requiresCoverLetter'] ?? ''` assigns a `String` to a `bool?` (`lib/models/profilesModel.dart:53`). Should be `?? -1` and `?? false`.
- [ ] The results cache ignores the arguments it was populated with, returning cached results regardless of `yearIndex` or `internSwitch` (`lib/services/generic/resultService.dart:15-17, 35-37`). Not reachable today only because the viewmodel happens to clear both caches on every filter change. Key the cache on year and type.
- [ ] `if (_list.length >= 0)` is always true (`lib/services/generic/applyService.dart:35, 76`; `lib/services/generic/resultService.dart:27, 47`). As written, one transient empty API reply pins an empty list in the cache until logout.
- [ ] `ProfilesModel.roundSet` is declared and passed through but `json['roundSet']` is never read, so it is always empty (`lib/models/profilesModel.dart:37, 55`). Populate it or delete it.
- [ ] Fetching resumes issues one extra sequential GET per resume to resolve the URL, so five resumes means six serial round-trips before the list appears (`lib/services/generic/applyService.dart:105-114`). Use `Future.wait`, or inline the URL in the list serializer.
- [ ] `WillPopScope` is deprecated and removed in current Flutter (`resultDetailsBranchWise.dart:41-42`, `resultDetailsCompanyWise.dart:41-42`). Replace with `PopScope`. This will break the build on the next SDK bump.
- [ ] `profileStatus(int index)` and `formatDate` are copy-pasted verbatim across three viewmodels, and the academic-year cutoff is duplicated in `lib/resources/endpoints.dart:8-13` and `lib/resources/modelResources.dart:6-9`. Each is a place a future fix gets applied to one copy only.

**Expected**

Each item either fixed or consciously dropped.

**Fix sketch**

- Work top to bottom; the first three are one-line changes.
- The duplicated academic-year cutoff should become one helper with an injectable `DateTime`, which also makes the 30 June / 1 July boundary testable.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start top to bottom through the named files: the candidate and profile models, resultService.dart, applyService.dart, resultDetailsBranchWise.dart, resultDetailsCompanyWise.dart, the three viewmodels, and the two resource files. Verify each checklist item against the current behavior and existing Flutter checks or build. Done means every item is fixed or consciously dropped, including cache correctness, empty-result handling, URL fetching, deprecated navigation APIs, and duplicated logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.