todos-contra-el-fuego-mobile/lib/models/fireNotification.dart
vjrj eb0d19621c 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
2026-03-05 02:10:14 +01:00

101 lines
2.8 KiB
Dart

import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:objectid/objectid.dart';
import '../objectIdUtils.dart';
part 'fireNotification.g.dart';
@JsonSerializable(nullable: false)
class FireNotification {
@JsonKey(toJson: objectIdToJson, fromJson: objectIdFromJson)
ObjectId id;
final double lat;
final double lon;
final String description;
final DateTime when;
final String sealed;
@JsonKey(toJson: objectIdToJson, fromJson: objectIdFromJson)
final ObjectId subsId;
final bool read;
factory FireNotification.fromJson(Map<String, dynamic> json) =>
_$FireNotificationFromJson(json);
FireNotification(
{this.id,
required this.lat,
required this.lon,
required this.description,
required this.when,
required this.read,
required this.sealed,
required this.subsId}) {
}
FireNotification copyWith(
{id, lat, lon, description, read, when, sealed, subsId}) {
return new FireNotification(
id: id ?? this.id,
lat: lat ?? this.lat,
lon: lon ?? this.lon,
read: read ?? this.read,
description: description ?? this.description,
sealed: sealed ?? this.sealed,
subsId: subsId ?? this.subsId,
when: when ?? this.when);
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is FireNotification &&
runtimeType == other.runtimeType &&
id == other.id &&
lat == other.lat &&
lon == other.lon &&
read == other.read &&
description == other.description &&
sealed == other.sealed &&
subsId == other.subsId &&
when == other.when;
@override
int get hashCode =>
id.hashCode ^
lat.hashCode ^
lon.hashCode ^
description.hashCode ^
when.hashCode ^
read.hashCode ^
sealed.hashCode ^
subsId.hashCode;
@override
String toString() {
return 'FireNotification {id: $id, lat: $lat, lon: $lon, when: $when, read: $read, subsId: $subsId, sealed ${ellipse(sealed)}';
}
static final Map<String, Route<Null>> routes = <String, Route<Null>>{};
Map<String, dynamic> toJson() => _$FireNotificationToJson(this);
/*
Route<Null> getRoute(Store store) {
final String routeName = '/fire/${id}';
return routes.putIfAbsent(
routeName,
() => new MaterialPageRoute<Null>(
settings: new RouteSettings(name: routeName),
builder: (BuildContext context) {
store.dispatch(new ShowFireNotificationMapAction(this));
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new genericMap()));
},
),
);
} */
}