- Add @immutable to classes with ==/hashCode (homePage, basicLocation, fireNotification, yourLocation, monitoredAreas) - Fix camel_case_types (genericMap → GenericMap) - Fix avoid_dynamic_calls (firesApi - typed responses) - Fix use_build_context_synchronously (locationUtils) - Fix always_put_control_body_on_new_line (4 reducers) - Fix always_specify_types (placesAutocompleteUtils, reducers) - Fix eol_at_end_of_file (4 files) - Fix prefer_function_declarations_over_variables (introPage) - Fix flutter_style_todos (fireMapReducer) Build: APK generated, 0 errors, 0 warnings
107 lines
3 KiB
Dart
107 lines
3 KiB
Dart
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';
|
|
|
|
part 'fireNotification.g.dart';
|
|
|
|
@immutable
|
|
@JsonSerializable()
|
|
class FireNotification {
|
|
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)
|
|
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()));
|
|
},
|
|
),
|
|
);
|
|
} */
|
|
}
|