High-priority fixes (10 issues): - assignment_to_final errors (7): Use copyWith() to respect immutability in YourLocation, active_fires.dart, generic_map.dart, location_utils.dart, and fetch_data_middleware.dart instead of direct assignment - Fixed import paths (3): Updated falsePositiveTypes.dart → false_positive_types.dart and firesApi.dart → fires_api.dart in reducers.dart, fire_notification_actions.dart, fires_api.dart Medium/Low priority fixes (3 issues): - unnecessary_non_null_assertion: Removed redundant '!' in app_intro_page.dart line 54 - use_super_parameters: Updated app_intro_page.dart to use modern super(key: key) syntax - no_logic_in_create_state: Fixed material_app_with_intro.dart by moving parameters to State instead of createState - noop_primitive_operations: Removed redundant .toString() in string interpolation - avoid_void_async: Changed void _selectLocation to Future<void> in places_autocomplete_utils.dart - avoid_dynamic_calls: Fixed dynamic map access in fires_api.dart by properly casting intermediate values Result: Reduced lint issues from 56 to 20 (all remaining are by-design: library_private_types_in_public_api and implementation_imports from external packages) APK builds successfully with no errors.
106 lines
2.9 KiB
Dart
106 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:objectid/objectid.dart';
|
|
|
|
import '../object_id_utils.dart';
|
|
import '../utils/widget_utils.dart';
|
|
|
|
part 'fire_notification.g.dart';
|
|
|
|
@immutable
|
|
@JsonSerializable()
|
|
class FireNotification {
|
|
const FireNotification(
|
|
{required this.id,
|
|
required this.lat,
|
|
required this.lon,
|
|
required this.description,
|
|
required this.when,
|
|
required this.read,
|
|
required this.sealed,
|
|
required this.subsId});
|
|
|
|
factory FireNotification.fromJson(Map<String, dynamic> json) =>
|
|
_$FireNotificationFromJson(json);
|
|
@JsonKey(toJson: objectIdToJson, fromJson: objectIdFromJson)
|
|
final 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;
|
|
|
|
FireNotification copyWith(
|
|
{ObjectId? id,
|
|
double? lat,
|
|
double? lon,
|
|
String? description,
|
|
bool? read,
|
|
DateTime? when,
|
|
String? sealed,
|
|
ObjectId? subsId}) {
|
|
return 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<void>> routes = <String, Route<void>>{};
|
|
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()));
|
|
},
|
|
),
|
|
);
|
|
} */
|
|
}
|