37 lines
656 B
Dart
37 lines
656 B
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
class CityEntity extends Equatable {
|
|
final String name;
|
|
final String coords;
|
|
|
|
const CityEntity({
|
|
required this.name,
|
|
required this.coords,
|
|
});
|
|
|
|
Map<String, Object?> toDocument() {
|
|
return {
|
|
'name': name,
|
|
'coords': coords,
|
|
};
|
|
}
|
|
|
|
static CityEntity fromDocument(Map<String, dynamic> doc) {
|
|
return CityEntity(
|
|
name: doc['name'] as String,
|
|
coords: doc['coords'] as String,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [name, coords];
|
|
|
|
@override
|
|
String toString() {
|
|
return '''CityEntity {
|
|
name: $name
|
|
coords: $coords
|
|
}''';
|
|
}
|
|
}
|