Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/platform_android/biometrics_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class BiometricsServiceImpl implements BiometricsService {

@override
Future<List<DeviceInfo?>> getListOfDevices(String modality) async {
List<DeviceInfo?> deviceList = List.empty();
List<DeviceInfo?> deviceList = [];
try {
deviceList = await BiometricsApi().getListOfDevices(modality);
} on PlatformException {
Expand Down
12 changes: 6 additions & 6 deletions lib/platform_android/process_spec_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class ProcessSpecServiceImpl implements ProcessSpecService {
listOfProcesses = await ProcessSpecApi().getNewProcessSpec();
} on PlatformException {
debugPrint("Process Spec Api failed!");
listOfProcesses = List.empty();
listOfProcesses = [];
} catch (e) {
listOfProcesses = List.empty();
listOfProcesses = [];
Comment on lines +21 to +23
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix is still partial: one fallback path remains fixed-length.

getMandatoryLanguageCodes() still uses List.empty() in exception paths (Line 61, Line 63), so the same UnsupportedError can still occur when consumers mutate the returned fallback list.

Suggested patch
   Future<List<String?>> getMandatoryLanguageCodes() async {
     List<String?> mandatoryLanguageCodes;
     try {
       mandatoryLanguageCodes = await ProcessSpecApi().getMandatoryLanguageCodes();
     } on PlatformException {
       debugPrint("Process Spec Api failed!");
-      mandatoryLanguageCodes = List.empty();
+      mandatoryLanguageCodes = [];
     }  catch (e) {
-      mandatoryLanguageCodes = List.empty();
+      mandatoryLanguageCodes = [];
       debugPrint("Process spec fetch error: $e");
     }
     return mandatoryLanguageCodes;
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/platform_android/process_spec_service_impl.dart` around lines 21 - 23,
getMandatoryLanguageCodes() still returns a fixed-length empty list via
List.empty() in its exception/fallback paths which causes UnsupportedError when
callers try to mutate it; replace those List.empty() returns with a growable
list (e.g., use [] or List.empty(growable: true) or List.from([])) in the
exception branches inside getMandatoryLanguageCodes() so callers can safely
modify the fallback list.

debugPrint("Process spec fetch error: $e");
}

Expand Down Expand Up @@ -99,9 +99,9 @@ class ProcessSpecServiceImpl implements ProcessSpecService {
optionalLanguageCodes = await ProcessSpecApi().getOptionalLanguageCodes();
} on PlatformException {
debugPrint("Process Spec Api failed!");
optionalLanguageCodes = List.empty();
optionalLanguageCodes = [];
} catch (e) {
optionalLanguageCodes = List.empty();
optionalLanguageCodes = [];
debugPrint("Process spec fetch error: $e");
}
return optionalLanguageCodes;
Expand All @@ -114,9 +114,9 @@ class ProcessSpecServiceImpl implements ProcessSpecService {
settingSpec = await ProcessSpecApi().getSettingSpec();
} on PlatformException {
debugPrint("Settings Spec Api failed!");
settingSpec = List.empty();
settingSpec = [];
} catch (e) {
settingSpec = List.empty();
settingSpec = [];
debugPrint("Settings spec fetch error: $e");
}
return settingSpec;
Expand Down