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:
parent
948a609619
commit
862d423f6b
14 changed files with 96 additions and 69 deletions
|
|
@ -19,15 +19,19 @@ class GlobalFiresBottomStats extends StatefulWidget {
|
|||
class _GlobalFiresBottomStatsState extends State<GlobalFiresBottomStats> {
|
||||
late String lastCheck;
|
||||
int activeFires = 0;
|
||||
final String firesApiUrl = GetIt.instance<String>(instanceName: 'firesApiUrl');
|
||||
final String firesApiUrl =
|
||||
GetIt.instance<String>(instanceName: 'firesApiUrl');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
http.read(Uri.parse('${firesApiUrl}status/last-fire-check')).then((String result) {
|
||||
http
|
||||
.read(Uri.parse('${firesApiUrl}status/last-fire-check'))
|
||||
.then((String result) {
|
||||
try {
|
||||
final Moment now = Moment.now();
|
||||
final DateTime last = DateTime.parse(json.decode(result)['value'] as String);
|
||||
final DateTime last =
|
||||
DateTime.parse(json.decode(result)['value'] as String);
|
||||
http
|
||||
.read(Uri.parse('${firesApiUrl}status/active-fires-count'))
|
||||
.then((String result) {
|
||||
|
|
@ -37,10 +41,12 @@ class _GlobalFiresBottomStatsState extends State<GlobalFiresBottomStats> {
|
|||
lastCheck = now.from(context, last);
|
||||
activeFires = count;
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (_) {
|
||||
// Ignore JSON parse errors
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (_) {
|
||||
// Ignore storage read errors
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -49,13 +55,11 @@ class _GlobalFiresBottomStatsState extends State<GlobalFiresBottomStats> {
|
|||
Widget build(BuildContext context) {
|
||||
final List<Widget> actionWidgets = <Widget>[];
|
||||
if (activeFires > 0) {
|
||||
actionWidgets.add(Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).activeFiresWorldWide(activeFires.toString())),
|
||||
Text(S.of(context).updatedLastCheck(lastCheck))
|
||||
]));
|
||||
actionWidgets
|
||||
.add(Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Text(S.of(context).activeFiresWorldWide(activeFires.toString())),
|
||||
Text(S.of(context).updatedLastCheck(lastCheck))
|
||||
]));
|
||||
}
|
||||
|
||||
return CustomBottomAppBar(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue