feat :
1 - search and filter location 2 - mapWidget
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'poultry_location_model.freezed.dart';
|
||||
part 'poultry_location_model.g.dart';
|
||||
@@ -8,61 +8,48 @@ abstract class PoultryLocationModel with _$PoultryLocationModel {
|
||||
const factory PoultryLocationModel({
|
||||
int? id,
|
||||
String? unitName,
|
||||
@JsonKey(name: 'Lat')
|
||||
double? lat,
|
||||
@JsonKey(name: 'Long')
|
||||
double? long,
|
||||
@JsonKey(name: 'Lat') double? lat,
|
||||
@JsonKey(name: 'Long') double? long,
|
||||
User? user,
|
||||
List<Hatching>? hatching,
|
||||
Address? address,
|
||||
String? breedingUniqueId,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) LatLng? latLng,
|
||||
}) = _PoultryLocationModel;
|
||||
|
||||
factory PoultryLocationModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$PoultryLocationModelFromJson(json);
|
||||
_$PoultryLocationModelFromJson(json).copyWith(
|
||||
latLng: (json['Lat'] != null && json['Long'] != null)
|
||||
? LatLng(json['Lat'] as double, json['Long'] as double)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class User with _$User {
|
||||
const factory User({
|
||||
String? fullname,
|
||||
String? mobile,
|
||||
}) = _User;
|
||||
const factory User({String? fullname, String? mobile}) = _User;
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Hatching with _$Hatching {
|
||||
const factory Hatching({
|
||||
const factory Hatching({int? leftOver, int? chickenAge, DateTime? date, String? licenceNumber}) =
|
||||
_Hatching;
|
||||
|
||||
int? leftOver,
|
||||
int? chickenAge,
|
||||
DateTime? date,
|
||||
String? licenceNumber,
|
||||
|
||||
}) = _Hatching;
|
||||
|
||||
factory Hatching.fromJson(Map<String, dynamic> json) =>
|
||||
_$HatchingFromJson(json);
|
||||
factory Hatching.fromJson(Map<String, dynamic> json) => _$HatchingFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Address with _$Address {
|
||||
const factory Address({
|
||||
City? city,
|
||||
String? address,
|
||||
}) = _Address;
|
||||
const factory Address({City? city, String? address}) = _Address;
|
||||
|
||||
factory Address.fromJson(Map<String, dynamic> json) =>
|
||||
_$AddressFromJson(json);
|
||||
factory Address.fromJson(Map<String, dynamic> json) => _$AddressFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class City with _$City {
|
||||
const factory City({
|
||||
String? name,
|
||||
}) = _City;
|
||||
const factory City({String? name}) = _City;
|
||||
|
||||
factory City.fromJson(Map<String, dynamic> json) => _$CityFromJson(json);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PoultryLocationModel {
|
||||
|
||||
int? get id; String? get unitName;@JsonKey(name: 'Lat') double? get lat;@JsonKey(name: 'Long') double? get long; User? get user; List<Hatching>? get hatching; Address? get address; String? get breedingUniqueId;
|
||||
int? get id; String? get unitName;@JsonKey(name: 'Lat') double? get lat;@JsonKey(name: 'Long') double? get long; User? get user; List<Hatching>? get hatching; Address? get address; String? get breedingUniqueId;@JsonKey(includeFromJson: false, includeToJson: false) LatLng? get latLng;
|
||||
/// Create a copy of PoultryLocationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,16 +28,16 @@ $PoultryLocationModelCopyWith<PoultryLocationModel> get copyWith => _$PoultryLoc
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other.hatching, hatching)&&(identical(other.address, address) || other.address == address)&&(identical(other.breedingUniqueId, breedingUniqueId) || other.breedingUniqueId == breedingUniqueId));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other.hatching, hatching)&&(identical(other.address, address) || other.address == address)&&(identical(other.breedingUniqueId, breedingUniqueId) || other.breedingUniqueId == breedingUniqueId)&&(identical(other.latLng, latLng) || other.latLng == latLng));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(hatching),address,breedingUniqueId);
|
||||
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(hatching),address,breedingUniqueId,latLng);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address, breedingUniqueId: $breedingUniqueId)';
|
||||
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address, breedingUniqueId: $breedingUniqueId, latLng: $latLng)';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract mixin class $PoultryLocationModelCopyWith<$Res> {
|
||||
factory $PoultryLocationModelCopyWith(PoultryLocationModel value, $Res Function(PoultryLocationModel) _then) = _$PoultryLocationModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId
|
||||
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId,@JsonKey(includeFromJson: false, includeToJson: false) LatLng? latLng
|
||||
});
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class _$PoultryLocationModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of PoultryLocationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,Object? breedingUniqueId = freezed,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,Object? breedingUniqueId = freezed,Object? latLng = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
|
||||
@@ -75,7 +75,8 @@ as double?,user: freezed == user ? _self.user : user // ignore: cast_nullable_to
|
||||
as User?,hatching: freezed == hatching ? _self.hatching : hatching // ignore: cast_nullable_to_non_nullable
|
||||
as List<Hatching>?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as Address?,breedingUniqueId: freezed == breedingUniqueId ? _self.breedingUniqueId : breedingUniqueId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as String?,latLng: freezed == latLng ? _self.latLng : latLng // ignore: cast_nullable_to_non_nullable
|
||||
as LatLng?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of PoultryLocationModel
|
||||
@@ -184,10 +185,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId, @JsonKey(includeFromJson: false, includeToJson: false) LatLng? latLng)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PoultryLocationModel() when $default != null:
|
||||
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId);case _:
|
||||
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId,_that.latLng);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -205,10 +206,10 @@ return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.ha
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId, @JsonKey(includeFromJson: false, includeToJson: false) LatLng? latLng) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PoultryLocationModel():
|
||||
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId);case _:
|
||||
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId,_that.latLng);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -225,10 +226,10 @@ return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.ha
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId, @JsonKey(includeFromJson: false, includeToJson: false) LatLng? latLng)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PoultryLocationModel() when $default != null:
|
||||
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId);case _:
|
||||
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId,_that.latLng);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -240,7 +241,7 @@ return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.ha
|
||||
@JsonSerializable()
|
||||
|
||||
class _PoultryLocationModel implements PoultryLocationModel {
|
||||
const _PoultryLocationModel({this.id, this.unitName, @JsonKey(name: 'Lat') this.lat, @JsonKey(name: 'Long') this.long, this.user, final List<Hatching>? hatching, this.address, this.breedingUniqueId}): _hatching = hatching;
|
||||
const _PoultryLocationModel({this.id, this.unitName, @JsonKey(name: 'Lat') this.lat, @JsonKey(name: 'Long') this.long, this.user, final List<Hatching>? hatching, this.address, this.breedingUniqueId, @JsonKey(includeFromJson: false, includeToJson: false) this.latLng}): _hatching = hatching;
|
||||
factory _PoultryLocationModel.fromJson(Map<String, dynamic> json) => _$PoultryLocationModelFromJson(json);
|
||||
|
||||
@override final int? id;
|
||||
@@ -259,6 +260,7 @@ class _PoultryLocationModel implements PoultryLocationModel {
|
||||
|
||||
@override final Address? address;
|
||||
@override final String? breedingUniqueId;
|
||||
@override@JsonKey(includeFromJson: false, includeToJson: false) final LatLng? latLng;
|
||||
|
||||
/// Create a copy of PoultryLocationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -273,16 +275,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other._hatching, _hatching)&&(identical(other.address, address) || other.address == address)&&(identical(other.breedingUniqueId, breedingUniqueId) || other.breedingUniqueId == breedingUniqueId));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other._hatching, _hatching)&&(identical(other.address, address) || other.address == address)&&(identical(other.breedingUniqueId, breedingUniqueId) || other.breedingUniqueId == breedingUniqueId)&&(identical(other.latLng, latLng) || other.latLng == latLng));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(_hatching),address,breedingUniqueId);
|
||||
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(_hatching),address,breedingUniqueId,latLng);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address, breedingUniqueId: $breedingUniqueId)';
|
||||
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address, breedingUniqueId: $breedingUniqueId, latLng: $latLng)';
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +295,7 @@ abstract mixin class _$PoultryLocationModelCopyWith<$Res> implements $PoultryLoc
|
||||
factory _$PoultryLocationModelCopyWith(_PoultryLocationModel value, $Res Function(_PoultryLocationModel) _then) = __$PoultryLocationModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId
|
||||
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId,@JsonKey(includeFromJson: false, includeToJson: false) LatLng? latLng
|
||||
});
|
||||
|
||||
|
||||
@@ -310,7 +312,7 @@ class __$PoultryLocationModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of PoultryLocationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,Object? breedingUniqueId = freezed,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,Object? breedingUniqueId = freezed,Object? latLng = freezed,}) {
|
||||
return _then(_PoultryLocationModel(
|
||||
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
|
||||
@@ -320,7 +322,8 @@ as double?,user: freezed == user ? _self.user : user // ignore: cast_nullable_to
|
||||
as User?,hatching: freezed == hatching ? _self._hatching : hatching // ignore: cast_nullable_to_non_nullable
|
||||
as List<Hatching>?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as Address?,breedingUniqueId: freezed == breedingUniqueId ? _self.breedingUniqueId : breedingUniqueId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as String?,latLng: freezed == latLng ? _self.latLng : latLng // ignore: cast_nullable_to_non_nullable
|
||||
as LatLng?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user