Skip to content

Commit 52444a2

Browse files
authored
chore: upgrade 7 major dependencies with API migrations (#194)
* chore: upgrade 66 package dependencies and fix null-aware element lints Ran flutter pub upgrade to bring all packages to latest within existing semver constraints (e.g. riverpod 3.1->3.3, drift 2.30->2.31, go_router 17.0->17.2, lints 6.0->6.1). Fixed use_null_aware_elements lint violations surfaced by lints 6.1.0 upgrade. * fix: pin device_info_plus to 12.3.0 to fix iOS build v12.4.0 calls NSProcessInfo.isiOSAppOnVision which is unavailable in Xcode 16.2's SDK, causing a compile error on iOS. Pin back to 12.3.0 via dependency_overrides until upstream fixes the availability guard. * feat: upgrade 7 direct dependencies with breaking API migrations Upgrade major versions: - file_picker 10.x -> 11.x (FilePicker.platform removed, use static methods) - flutter_local_notifications 18.x -> 21.x (positional -> named params) - flutter_contacts 1.x -> 2.x (static -> sub-API pattern) - desktop_drop 0.4.x -> 0.7.x (XFile -> DropItem) - googleapis 15.x -> 16.x - native_exif 0.6.x -> 0.7.x - timezone 0.10.x -> 0.11.x * fix: bump desugar_jdk_libs to 2.1.4 for flutter_local_notifications 21.x flutter_local_notifications 21.x requires desugar_jdk_libs >= 2.1.4 but the project had 2.0.4, causing Android build failure. * test: add coverage for FilePicker API migration and rename test helper Add MockFilePickerPlatform to exercise FilePicker.saveFile/pickFiles code paths across CSV, Excel, KML, and file_export_utils services. Rename _xFileFromBytes to _dropItemFromBytes in drop target test to match the desktop_drop 0.7.x DropItem type. * refactor: centralise FilePickerPlatform src/ import in mock helper Re-export FilePickerPlatform from mock_file_picker_platform.dart so test files avoid direct dependency on file_picker's internal src/ path.
1 parent 7eb7cca commit 52444a2

25 files changed

Lines changed: 312 additions & 86 deletions

android/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ flutter {
6666
}
6767

6868
dependencies {
69-
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
69+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
7070
implementation("androidx.exifinterface:exifinterface:1.3.7")
7171
}

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ SPEC CHECKSUMS:
271271
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
272272
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
273273
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
274-
flutter_contacts: 5383945387e7ca37cf963d4be57c21f2fc15ca9f
275-
flutter_local_notifications: 395056b3175ba4f08480a7c5de30cd36d69827e4
274+
flutter_contacts: 2ec1d6b62ca2869c3bbb3871bd74d4e3ef157135
275+
flutter_local_notifications: 643a3eda1ce1c0599413ca31672536d423dee214
276276
flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23
277277
gal: baecd024ebfd13c441269ca7404792a7152fde89
278278
geocoding_ios: 33776c9ebb98d037b5e025bb0e7537f6dd19646e

lib/core/services/database_location_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class DatabaseLocationService {
139139

140140
// On other platforms, use file_picker
141141
try {
142-
final result = await FilePicker.platform.getDirectoryPath(
142+
final result = await FilePicker.getDirectoryPath(
143143
dialogTitle: 'Choose Database Storage Location',
144144
lockParentWindow: true,
145145
);

lib/core/services/export/csv/csv_export_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class CsvExportService {
280280
final dateStr = _dateFormat.format(DateTime.now());
281281
final fileName = 'dives_export_$dateStr.csv';
282282

283-
final result = await FilePicker.platform.saveFile(
283+
final result = await FilePicker.saveFile(
284284
dialogTitle: 'Save Dives CSV',
285285
fileName: fileName,
286286
type: FileType.custom,
@@ -304,7 +304,7 @@ class CsvExportService {
304304
final dateStr = _dateFormat.format(DateTime.now());
305305
final fileName = 'sites_export_$dateStr.csv';
306306

307-
final result = await FilePicker.platform.saveFile(
307+
final result = await FilePicker.saveFile(
308308
dialogTitle: 'Save Sites CSV',
309309
fileName: fileName,
310310
type: FileType.custom,
@@ -328,7 +328,7 @@ class CsvExportService {
328328
final dateStr = _dateFormat.format(DateTime.now());
329329
final fileName = 'equipment_export_$dateStr.csv';
330330

331-
final result = await FilePicker.platform.saveFile(
331+
final result = await FilePicker.saveFile(
332332
dialogTitle: 'Save Equipment CSV',
333333
fileName: fileName,
334334
type: FileType.custom,

lib/core/services/export/excel/excel_export_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class ExcelExportService {
124124
final dateStr = _dateFormat.format(DateTime.now());
125125
final fileName = 'submersion_export_$dateStr.xlsx';
126126

127-
final result = await FilePicker.platform.saveFile(
127+
final result = await FilePicker.saveFile(
128128
dialogTitle: 'Save Excel File',
129129
fileName: fileName,
130130
type: FileType.custom,

lib/core/services/export/kml/kml_export_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class KmlExportService {
7979
final dateStr = _dateFormat.format(DateTime.now());
8080
final fileName = 'submersion_sites_$dateStr.kml';
8181

82-
final result = await FilePicker.platform.saveFile(
82+
final result = await FilePicker.saveFile(
8383
dialogTitle: 'Save KML File',
8484
fileName: fileName,
8585
type: FileType.custom,

lib/core/services/export/pdf/pdf_export_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class PdfExportService {
198198
allSightings: allSightings,
199199
);
200200

201-
final saveResult = await FilePicker.platform.saveFile(
201+
final saveResult = await FilePicker.saveFile(
202202
dialogTitle: 'Save PDF File',
203203
fileName: result.fileName,
204204
type: FileType.custom,

lib/core/services/export/shared/file_export_utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Future<String> saveImageToPhotos(List<int> pngBytes, String fileName) async {
8383
/// Opens a file picker dialog allowing the user to choose where to save.
8484
/// Returns the saved file path, or null if the user cancelled.
8585
Future<String?> saveImageToFile(List<int> pngBytes, String fileName) async {
86-
final result = await FilePicker.platform.saveFile(
86+
final result = await FilePicker.saveFile(
8787
dialogTitle: 'Save Profile Image',
8888
fileName: fileName,
8989
type: FileType.image,
@@ -111,7 +111,7 @@ Future<String> sharePdfBytes(List<int> pdfBytes, String fileName) async {
111111
/// Opens a file picker dialog allowing the user to choose where to save.
112112
/// Returns the saved file path, or null if the user cancelled.
113113
Future<String?> savePdfToFile(List<int> pdfBytes, String fileName) async {
114-
final result = await FilePicker.platform.saveFile(
114+
final result = await FilePicker.saveFile(
115115
dialogTitle: 'Save PDF',
116116
fileName: fileName,
117117
type: FileType.custom,

lib/core/services/export/uddf/uddf_full_export_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ class UddfFullExportService {
532532
final fileName =
533533
'submersion_backup_${_dateFormat.format(DateTime.now())}.uddf';
534534

535-
final result = await FilePicker.platform.saveFile(
535+
final result = await FilePicker.saveFile(
536536
dialogTitle: 'Save UDDF File',
537537
fileName: fileName,
538538
type: FileType.custom,

lib/core/services/notification_service.dart

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class NotificationService {
6464
);
6565

6666
await _plugin.initialize(
67-
initSettings,
67+
settings: initSettings,
6868
onDidReceiveNotificationResponse: _onNotificationTapped,
6969
);
7070

@@ -166,15 +166,13 @@ class NotificationService {
166166
final scheduledTz = tz.TZDateTime.from(scheduledDate, tz.local);
167167

168168
await _plugin.zonedSchedule(
169-
notificationId,
170-
title,
171-
body,
172-
scheduledTz,
173-
details,
169+
id: notificationId,
170+
title: title,
171+
body: body,
172+
scheduledDate: scheduledTz,
173+
notificationDetails: details,
174174
payload: equipmentId,
175175
androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
176-
uiLocalNotificationDateInterpretation:
177-
UILocalNotificationDateInterpretation.absoluteTime,
178176
);
179177

180178
_log.info(
@@ -222,15 +220,20 @@ class NotificationService {
222220
// Use a fixed ID so repeated backup notifications replace each other
223221
const backupNotificationId = 99000;
224222

225-
await _plugin.show(backupNotificationId, title, body, details);
223+
await _plugin.show(
224+
id: backupNotificationId,
225+
title: title,
226+
body: body,
227+
notificationDetails: details,
228+
);
226229

227230
_log.info('Showed backup notification (success: $success)');
228231
}
229232

230233
/// Cancel a specific notification
231234
Future<void> cancelNotification(int notificationId) async {
232235
if (!_isMobilePlatform) return;
233-
await _plugin.cancel(notificationId);
236+
await _plugin.cancel(id: notificationId);
234237
_log.info('Cancelled notification $notificationId');
235238
}
236239

0 commit comments

Comments
 (0)