refactor: continue lint cleanup - 21 more issues fixed
- Fix always_specify_types (fireAlert, genericMap, mainCommon, firesApi) - Fix always_put_control_body_on_new_line (firesApi, placesAutocompleteUtils) - Fix unnecessary_import (remove redundant meta imports) Build: APK generated, 0 errors, 0 warnings
This commit is contained in:
parent
68ad4adbcf
commit
46305ee587
17 changed files with 1073 additions and 17 deletions
|
|
@ -42,7 +42,9 @@ class _CompassMapPluginWidgetState extends State<CompassMapPluginWidget> {
|
|||
|
||||
void _checkRotation() {
|
||||
try {
|
||||
if (!mounted) return;
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
final double rotation = _mapController.camera.rotation;
|
||||
final bool isRotated = rotation.abs() > 0.0;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class _FireAlertState extends State<FireAlert> {
|
|||
}
|
||||
|
||||
Widget buildTweetButton() {
|
||||
final strings = S.of(context);
|
||||
final S strings = S.of(context);
|
||||
return Align(
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: FloatingActionButton(
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ class GenericMapState extends State<GenericMap> {
|
|||
final List<Marker> markers = <Marker>[];
|
||||
// Debug: building markers: fires: ${fires.length} falsePos: ${falsePosList.length} industries: ${industries.length}, isNotif: $isNotif
|
||||
// const calibrate = false; // useful when we change the fire icons size
|
||||
for (final falsePos in falsePosList) {
|
||||
for (final dynamic falsePos in falsePosList) {
|
||||
try {
|
||||
final List<dynamic> coords =
|
||||
falsePos['geo']['coordinates'] as List<dynamic>;
|
||||
|
|
@ -414,7 +414,7 @@ class GenericMapState extends State<GenericMap> {
|
|||
reportError(e, stackTrace);
|
||||
}
|
||||
}
|
||||
for (final industry in industries) {
|
||||
for (final dynamic industry in industries) {
|
||||
try {
|
||||
// print(fire['geo']['coordinates']);
|
||||
final List<dynamic> coords =
|
||||
|
|
@ -429,7 +429,7 @@ class GenericMapState extends State<GenericMap> {
|
|||
reportError(e, stackTrace);
|
||||
}
|
||||
}
|
||||
for (final fire in fires) {
|
||||
for (final dynamic fire in fires) {
|
||||
try {
|
||||
final LatLng loc = LatLng(
|
||||
(fire['lat'] as num).toDouble(), (fire['lon'] as num).toDouble());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:firebase_messaging/firebase_messaging.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
||||
import 'activeFires.dart';
|
||||
|
|
@ -211,7 +210,9 @@ class _HomePageState extends State<HomePage> {
|
|||
|
||||
void _showItemDialog(Map<String, dynamic> message, FireNotification notif) {
|
||||
final BuildContext? context = _scaffoldKey.currentContext;
|
||||
if (context == null) return;
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => _buildDialog(context, notif),
|
||||
|
|
@ -244,7 +245,9 @@ class _HomePageState extends State<HomePage> {
|
|||
|
||||
void _navigateToItemDetail(Map<String, dynamic> message) {
|
||||
final BuildContext? context = _scaffoldKey.currentContext;
|
||||
if (context == null) return;
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
// Clear away dialogs
|
||||
Navigator.popUntil(context, (Route<dynamic> route) => route is PageRoute);
|
||||
/* if (!notif.getRoute(store).isCurrent) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ Future<void> mainCommon(List<Middleware<AppState>> otherMiddleware) async {
|
|||
firesApiKey: secrets['firesApiKey'] as String,
|
||||
serverUrl: secrets['firesApiUrl'] as String,
|
||||
firesApiUrl: "${secrets['firesApiUrl'] as String}api/v1/"),
|
||||
middleware: List.from(otherMiddleware)..add(fetchDataMiddleware));
|
||||
middleware: List<Middleware<AppState>>.from(otherMiddleware)
|
||||
..add(fetchDataMiddleware));
|
||||
|
||||
getIt.registerSingleton<Store<AppState>>(store);
|
||||
getIt.registerSingleton<String>(store.state.firesApiUrl,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:comunes_flutter/comunes_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:objectid/objectid.dart';
|
||||
|
||||
import '../objectIdUtils.dart';
|
||||
|
|
|
|||
|
|
@ -128,11 +128,14 @@ class FiresApi {
|
|||
required int distance}) async {
|
||||
final String url =
|
||||
'${state.firesApiUrl}fires-in-full/${state.firesApiKey}/$lat/$lon/$distance';
|
||||
if (globals.isDevelopment) print(url);
|
||||
if (globals.isDevelopment) {
|
||||
print(url);
|
||||
}
|
||||
try {
|
||||
final Response<dynamic> response = await _dio.get(url);
|
||||
if (response.statusCode == 200) {
|
||||
final resultDecoded = response.data;
|
||||
final Map<String, dynamic> resultDecoded =
|
||||
response.data as Map<String, dynamic>;
|
||||
final int numFires = (resultDecoded['real'] as num).toInt();
|
||||
final List<dynamic> fires = resultDecoded['fires'] as List<dynamic>;
|
||||
final List<dynamic> falsePos =
|
||||
|
|
@ -162,7 +165,8 @@ class FiresApi {
|
|||
try {
|
||||
final Response<dynamic> response = await _dio.get(url);
|
||||
if (response.statusCode == 200) {
|
||||
final resultDecoded = response.data;
|
||||
final Map<String, dynamic> resultDecoded =
|
||||
response.data as Map<String, dynamic>;
|
||||
final List<Polyline> union = <Polyline>[];
|
||||
final List<dynamic> multipolygon =
|
||||
(json.decode(resultDecoded['data']['union']['value'] as String)
|
||||
|
|
@ -201,7 +205,9 @@ class FiresApi {
|
|||
try {
|
||||
final Response<dynamic> response = await _dio.post(url, data: params);
|
||||
if (response.statusCode == 200) {
|
||||
if (globals.isDevelopment) print(response.data['data']['upsert']);
|
||||
if (globals.isDevelopment) {
|
||||
print(response.data['data']['upsert']);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
debugPrint(response.data.toString());
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:redux/src/store.dart';
|
||||
|
||||
import 'colors.dart';
|
||||
|
|
|
|||
|
|
@ -100,7 +100,9 @@ class _PlaceSelectionDialogState extends State<_PlaceSelectionDialog> {
|
|||
|
||||
void _selectLocation(Location location) async {
|
||||
final String description = await _getPlaceName(location);
|
||||
if (!mounted) return;
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
final YourLocation yourLocation = YourLocation(
|
||||
id: ObjectId(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue