This commit is contained in:
Felipe
2024-02-19 18:16:51 -05:00
parent 9e6f76e309
commit 997c6047bb
34 changed files with 1235 additions and 594 deletions
@@ -0,0 +1,46 @@
import 'package:equatable/equatable.dart';
import '../entities/entities.dart';
class City extends Equatable {
final String name;
final String coords;
const City({
required this.name,
required this.coords,
});
static const empty = City(name: '', coords: '');
City copyWith({
String? name,
String? coords,
}) {
return City(
name: name ?? this.name,
coords: coords ?? this.coords,
);
}
bool get isEmpty => this == City.empty;
bool get isNotEmpty => this != City.empty;
City toEntity() {
return City(
name: name,
coords: coords,
);
}
static City fromEntity(CityEntity entity) {
return City(
name: entity.name,
coords: entity.coords,
);
}
@override
List<Object?> get props => [name, coords];
}