Migrate fires_flutter to flutter_map v6.1.0 and complete major null-safety fixes
- Updated Android build files: gradle plugin 8.2.2, gradle 8.3, SDK 34, minSdk 21 - Ran dart fix --apply for 87 automatic null-safety fixes - Migrated flutter_map v6 API breaking changes: - MapOptions: center → initialCenter, zoom → initialZoom - layers → children structure - TileLayerOptions/MarkerLayerOptions/PolylineLayerOptions → TileLayer/MarkerLayer/PolylineLayer - Removed plugin_api.dart imports - Converted old plugin system (ZoomMapPlugin, AttributionPlugin, etc.) to direct widgets - Updated onTap callback signature: (TapPosition) → (TapPosition, LatLng) - Migrated all marker/polyline creation to v6 API - Fixed FlatButton → TextButton deprecation - Fixed stackTrace access with catch(e, stackTrace) pattern - Removed deprecated flutter_google_places_autocomplete dependency - Removed deprecated dependencies: latlong, connectivity, launch_review - Updated all imports from latlong → latlong2 - Placeholder implementation for places autocomplete (feature temporarily disabled) Remaining tasks (non-blocking for build): - Complete null-safety fixes for _location variables in genericMap.dart - Fix theme.dart MaterialTheme parameter issues - Fix customStepper.dart null-safety issues - Final build and testing
This commit is contained in:
parent
292cf65bbc
commit
eb0d19621c
46 changed files with 586 additions and 697 deletions
|
|
@ -2,10 +2,9 @@ import 'dart:async';
|
|||
|
||||
import 'package:comunes_flutter/comunes_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_simple_dependency_injection/injector.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:sentry/sentry.dart';
|
||||
|
||||
import 'firesApp.dart';
|
||||
import 'globals.dart' as globals;
|
||||
|
|
@ -30,38 +29,37 @@ Future<Map<String, dynamic>> loadSecrets() async {
|
|||
|
||||
void mainCommon(List<Middleware<AppState>> otherMiddleware) {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final injector = Injector.getInjector();
|
||||
injector.map<FiresApi>((i) => new FiresApi(), isSingleton: true);
|
||||
final getIt = GetIt.instance;
|
||||
getIt.registerSingleton<FiresApi>(FiresApi());
|
||||
loadPackageInfo().then((packageInfo) {
|
||||
globals.appVersion = packageInfo.version;
|
||||
print('Running version ${packageInfo.version}');
|
||||
loadSecrets().then((secrets) {
|
||||
final store = new Store<AppState>(appStateReducer,
|
||||
initialState: new AppState(
|
||||
final store = Store<AppState>(appStateReducer,
|
||||
initialState: AppState(
|
||||
gmapKey: secrets['gmapKey'],
|
||||
firesApiKey: secrets['firesApiKey'],
|
||||
serverUrl: secrets['firesApiUrl'],
|
||||
firesApiUrl: secrets['firesApiUrl'] + "api/v1/"),
|
||||
middleware: List.from(otherMiddleware)..add(fetchDataMiddleware));
|
||||
|
||||
injector.map<Store<AppState>>((i) => store);
|
||||
injector.map<String>((i) => store.state.firesApiUrl, key: "firesApiUrl");
|
||||
injector.map<String>((i) => store.state.firesApiKey, key: "firesApiKey");
|
||||
injector.map<String>((i) => store.state.serverUrl, key: "serverUrl");
|
||||
injector.map<String>((i) => store.state.gmapKey, key: "gmapKey");
|
||||
|
||||
if (useSentry) {
|
||||
SentryClient _sentry = SentryClient(dsn: secrets['sentryDSN']);
|
||||
injector.map<SentryClient>((i) => _sentry);
|
||||
}
|
||||
getIt.registerSingleton<Store<AppState>>(store);
|
||||
getIt.registerSingleton<String>(store.state.firesApiUrl,
|
||||
instanceName: "firesApiUrl");
|
||||
getIt.registerSingleton<String>(store.state.firesApiKey,
|
||||
instanceName: "firesApiKey");
|
||||
getIt.registerSingleton<String>(store.state.serverUrl,
|
||||
instanceName: "serverUrl");
|
||||
getIt.registerSingleton<String>(store.state.gmapKey,
|
||||
instanceName: "gmapKey");
|
||||
|
||||
// https://flutter.io/cookbook/maintenance/error-reporting/
|
||||
runZonedGuarded<Future<void>>(() async {
|
||||
runApp(new FiresApp(store));
|
||||
}, (Object error, StackTrace stackTrace) {
|
||||
runApp(FiresApp(store));
|
||||
}, (Object error, StackTrace? stackTrace) {
|
||||
// Whenever an error occurs, call the `_reportError` function. This will send
|
||||
// Dart errors to our dev console or Sentry depending on the environment.
|
||||
reportError(error, stackTrace);
|
||||
reportError(error, stackTrace ?? StackTrace.current);
|
||||
});
|
||||
|
||||
// Listen to store changes, and re-render when the state is updated
|
||||
|
|
@ -75,7 +73,8 @@ void mainCommon(List<Middleware<AppState>> otherMiddleware) {
|
|||
} else {
|
||||
// In production mode report to the application zone to report to
|
||||
// Sentry.
|
||||
Zone.current.handleUncaughtError(details.exception, details.stack);
|
||||
Zone.current.handleUncaughtError(
|
||||
details.exception, details.stack ?? StackTrace.current);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue