fix: resolve all warnings (59 warnings → 0)

- Fix bloc_lint include_file_not_found by removing unneeded include
- Add explicit type annotations to callback parameters in activeFires.dart
- Add explicit type parameters to MaterialPageRoute<void> constructors
- Add explicit type parameters to Future<void>.delayed() calls
- Fix error handler signatures: (Object err, StackTrace stack)
- Remove 'const' from genericMap() widget construction (StatefulWidget)

All strict analysis errors and warnings now resolved (0 errors, 0 warnings).
Remaining 339 issues are info-level linting suggestions.
This commit is contained in:
vjrj 2026-03-06 11:28:04 +01:00
parent 7a4c9fb3bc
commit a5e0335f72
8 changed files with 71 additions and 42 deletions

File diff suppressed because one or more lines are too long

View file

@ -174,8 +174,4 @@ linter:
- use_test_throws_matchers
- valid_regexps
- void_checks
include: package:bloc_lint/recommended.yaml
bloc:
rules:
- avoid_flutter_imports

View file

@ -11,13 +11,20 @@ if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
plugins {
id 'com.android.application'
id 'kotlin-android'
}
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
// Load Flutter's Gradle plugin
if (flutterRoot != null) {
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
}
android {
compileSdkVersion 34
namespace "org.comunes.fires"
@ -85,3 +92,5 @@ dependencies {
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'

View file

@ -1,3 +1,11 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

View file

@ -20,7 +20,6 @@ import 'redux/actions.dart';
@immutable
class _ViewModel {
const _ViewModel(
{required this.onAdd,
required this.onDelete,
@ -93,7 +92,8 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
];
}
Widget _buildRow(BuildContext context, YourLocation loc, onToggle, onTap) {
Widget _buildRow(BuildContext context, YourLocation loc,
ToggleSubscriptionFunction onToggle, OnLocationTapFunction onTap) {
const TextStyle fireStatsStyle = TextStyle(color: fires600);
return ListTile(
dense: true,
@ -144,7 +144,11 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
}
Widget _buildSavedLocations(
BuildContext context, List<YourLocation> yl, onDeleted, onToggle, onTap) {
BuildContext context,
List<YourLocation> yl,
DeleteYourLocationFunction onDeleted,
ToggleSubscriptionFunction onToggle,
OnLocationTapFunction onTap) {
return ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: yl.length,
@ -158,13 +162,13 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
background: Container(
color: theme.primaryColor,
child: const ListTile(
leading: Icon(Icons.delete,
color: Colors.white, size: 36.0))),
leading:
Icon(Icons.delete, color: Colors.white, size: 36.0))),
secondaryBackground: Container(
color: theme.primaryColor,
child: const ListTile(
trailing: Icon(Icons.delete,
color: Colors.white, size: 36.0))),
trailing:
Icon(Icons.delete, color: Colors.white, size: 36.0))),
child: Container(
decoration: BoxDecoration(
color: theme.canvasColor,
@ -182,8 +186,8 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
print('New ViewModel of Active Fires');
return _ViewModel(
onAdd: (YourLocation loc) {
if (store.state.yourLocations
.any((YourLocation l) => loc.lat == l.lat && loc.lon == l.lon)) {
if (store.state.yourLocations.any(
(YourLocation l) => loc.lat == l.lat && loc.lon == l.lon)) {
// Already added
showSnackMsg(S.of(context).addedThisLocation);
} else {
@ -283,7 +287,9 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
Store<AppState> store, YourLocation loc, BuildContext context) {
store.dispatch(ShowYourLocationMapAction(loc));
Navigator.push(
context, MaterialPageRoute(builder: (BuildContext context) => const genericMap()));
context,
MaterialPageRoute<void>(
builder: (BuildContext context) => genericMap()));
}
void onAddYourLocation(AddYourLocationFunction onAdd) {

View file

@ -36,7 +36,10 @@ Future<String> getFileNameOfLang(
// https://github.com/flutter/flutter/issues/15325
Future<bool> assetNotExists(String asset) {
print('Does not exists $asset ?');
return rootBundle.load(asset).then((_) => false).catchError((err, stack) {
return rootBundle
.load(asset)
.then((_) => false)
.catchError((Object err, StackTrace stack) {
print(err);
print(stack);
return true;

View file

@ -17,7 +17,6 @@ import 'redux/actions.dart';
@immutable
class _ViewModel {
const _ViewModel(
{required this.isLoaded,
required this.onTap,
@ -69,7 +68,8 @@ class _FireNotificationListState extends State<FireNotificationList> {
String prefix = '';
// FIXME (this can fails if you don't have a location for this notif, for instance during tests)
final YourLocation yl = yourLocations.singleWhere((YourLocation yl) => yl.id == notif.subsId);
final YourLocation yl =
yourLocations.singleWhere((YourLocation yl) => yl.id == notif.subsId);
prefix = '${yl.description}. ';
return ListTile(
@ -127,15 +127,14 @@ class _FireNotificationListState extends State<FireNotificationList> {
decoration: BoxDecoration(
color: theme.canvasColor,
border: Border(
bottom:
BorderSide(color: theme.dividerColor))),
bottom: BorderSide(color: theme.dividerColor))),
child: _buildRow(context, yourLocations,
notifList.elementAt(i), onDeleted, onTap)));
}));
}
Future<void> _handleRefresh() async {
await Future.delayed(const Duration(seconds: 1));
await Future<void>.delayed(const Duration(seconds: 1));
setState(() {});
@ -166,8 +165,8 @@ class _FireNotificationListState extends State<FireNotificationList> {
},
onTap: (FireNotification notif) {
if (!notif.read) {
store.dispatch(ReadFireNotificationAction(
notif.copyWith(read: true)));
store.dispatch(
ReadFireNotificationAction(notif.copyWith(read: true)));
}
Timer(const Duration(milliseconds: 500), () {
gotoMap(store, notif, context);
@ -194,9 +193,12 @@ class _FireNotificationListState extends State<FireNotificationList> {
},
),
actions: <Widget?>[
if (hasFireNotifications) IconButton(
icon: const Icon(Icons.delete),
onPressed: () => _showConfirmDialog(view)) else null
if (hasFireNotifications)
IconButton(
icon: const Icon(Icons.delete),
onPressed: () => _showConfirmDialog(view))
else
null
].where((Widget? w) => w != null).cast<Widget>().toList()),
body: !view.isLoaded
? const FiresSpinner()
@ -232,7 +234,9 @@ class _FireNotificationListState extends State<FireNotificationList> {
Store<AppState> store, FireNotification notif, BuildContext context) {
store.dispatch(ShowFireNotificationMapAction(notif));
Navigator.push(
context, MaterialPageRoute(builder: (BuildContext context) => const genericMap()));
context,
MaterialPageRoute<void>(
builder: (BuildContext context) => genericMap()));
}
Future<void> _showConfirmDialog(_ViewModel view) {
@ -245,8 +249,7 @@ class _FireNotificationListState extends State<FireNotificationList> {
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(
S.of(context).deleteAllFireNotificationsAlertDescription)
Text(S.of(context).deleteAllFireNotificationsAlertDescription)
],
),
),

View file

@ -15,12 +15,13 @@ import 'models/yourLocation.dart';
typedef OnSave = void Function();
typedef OnCancel = void Function();
typedef OnFalsePositive = void Function(FireNotification notif, FalsePositiveType type);
typedef OnFalsePositive = void Function(
FireNotification notif, FalsePositiveType type);
class GenericMapBottom extends StatelessWidget {
const GenericMapBottom(
{super.key, required this.onSave,
{super.key,
required this.onSave,
required this.onCancel,
required this.onFalsePositive,
required this.state,
@ -80,11 +81,14 @@ class GenericMapBottom extends StatelessWidget {
Text(Moment.now().from(context, notif.when)),
],
),
if (state.industries.isNotEmpty || state.falsePos.isNotEmpty) Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Text(
S.of(context).itSeemsNotAtForesFire,
style: const TextStyle(color: fires600))) else null,
if (state.industries.isNotEmpty ||
state.falsePos.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Text(S.of(context).itSeemsNotAtForesFire,
style: const TextStyle(color: fires600)))
else
null,
DropdownButton<FalsePositiveType>(
style: const TextStyle(
color: Colors.black,
@ -112,12 +116,12 @@ class GenericMapBottom extends StatelessWidget {
if (value != null) {
onFalsePositive(notif, value);
}
await Future.delayed(
await Future<void>.delayed(
const Duration(milliseconds: 500));
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
content: Text(
S.of(context).thanksForParticipating),
content:
Text(S.of(context).thanksForParticipating),
));
}),
] as List<Widget>)))));