before
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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
|
||||
}''';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user