todos-contra-el-fuego-mobile/lib/models/fireNotification.dart
vjrj 8da3752193 Fix 23 additional lint issues to reduce from 129 to 106 issues
- Add const constructors to @immutable classes (5 issues: prefer_const_constructors_in_immutables)
- Fix nullable value casts in firesApi.dart (3 issues: cast_nullable_to_non_nullable)
- Remove redundant default argument values (2 issues: avoid_redundant_argument_values)
- Make YourLocation immutable with final fields (2 issues: avoid_equals_and_hash_code_on_mutable_classes)
- Update imports and fix formatting

Reduces lint issues from 129 to 106. APK builds successfully (146 MB).
2026-03-11 23:45:06 +01:00

106 lines
2.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:objectid/objectid.dart';
import '../objectIdUtils.dart';
import '../utils/widget_utils.dart';
part 'fireNotification.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()));
},
),
);
} */
}