refactor: fix remaining lint warnings and deprecated APIs

- Fix deprecated @ignore in json_serializable models (appState, yourLocation)
- Fix empty catch blocks in compassMapPlugin, globalFiresBottomStats, locationUtils
- Fix no_logic_in_create_state in firesApp, markdownPage, slider
- Fix use_build_context_synchronously in fireAlert
- Fix only_throw_errors in firesApi (8 instances)
- Exclude generated .g.dart files from analysis
- Update deprecated nullable: false to @JsonSerializable()

Build: APK generated successfully, 0 errors, 0 warnings
This commit is contained in:
vjrj 2026-03-07 09:35:59 +01:00
parent 948a609619
commit 862d423f6b
14 changed files with 96 additions and 69 deletions

View file

@ -17,7 +17,7 @@ export 'fireMapState.dart';
part 'appState.g.dart';
@immutable
@JsonSerializable(nullable: false)
@JsonSerializable()
class AppState {
const AppState(
{this.yourLocations = const <YourLocation>[],
@ -37,27 +37,27 @@ class AppState {
factory AppState.fromJson(Map<String, dynamic> json) =>
_$AppStateFromJson(json);
final bool isLoading;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final bool isLoaded;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final String error;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final User user;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final String gmapKey;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final String serverUrl;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final String firesApiKey;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final String firesApiUrl;
final List<YourLocation> yourLocations;
final List<FireNotification> fireNotifications;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final List<Polyline> monitoredAreas;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final int fireNotificationsUnread;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
final FireMapState fireMapState;
AppState copyWith(

View file

@ -1,4 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
part of 'appState.dart';

View file

@ -1,4 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
part of 'fireNotification.dart';

View file

@ -32,10 +32,10 @@ class FiresApi {
if (response.statusCode == 200) {
return response.data['data']['userId'] as String;
} else {
throw 'Unexpected error on create user';
throw Exception('Unexpected error on create user');
}
} catch (e) {
throw 'Error creating user: $e';
throw Exception('Error creating user: $e');
}
}
@ -64,10 +64,10 @@ class FiresApi {
}
return subscribed;
} else {
throw 'Unexpected error fetching your locations';
throw Exception('Unexpected error fetching your locations');
}
} catch (e) {
throw 'Error fetching locations: $e';
throw Exception('Error fetching locations: $e');
}
}
@ -86,10 +86,10 @@ class FiresApi {
if (response.statusCode == 200) {
return response.data['data']['subsId'] as String;
} else {
throw 'Unexpected error on subscribe';
throw Exception('Unexpected error on subscribe');
}
} catch (e) {
throw 'Error subscribing: $e';
throw Exception('Error subscribing: $e');
}
}
@ -103,10 +103,10 @@ class FiresApi {
if (response.statusCode == 200) {
return true;
} else {
throw 'Unexpected error on unsubscribe';
throw Exception('Unexpected error on unsubscribe');
}
} catch (e) {
throw 'Error unsubscribing: $e';
throw Exception('Error unsubscribing: $e');
}
}

View file

@ -5,7 +5,7 @@ import '../objectIdUtils.dart';
part 'yourLocation.g.dart';
@JsonSerializable(nullable: false)
@JsonSerializable()
class YourLocation {
YourLocation(
{required this.id,

View file

@ -1,4 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
part of 'yourLocation.dart';