feat : live stock batch
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'livestock_model.freezed.dart';
|
||||
part 'livestock_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LivestockData with _$LivestockData {
|
||||
const factory LivestockData({Rancher? rancher, Herd? herd, List<Livestock>? livestock}) =
|
||||
_LivestockData;
|
||||
|
||||
factory LivestockData.fromJson(Map<String, dynamic> json) => _$LivestockDataFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Rancher with _$Rancher {
|
||||
const factory Rancher({String? name, String? phone, String? image}) = _Rancher;
|
||||
|
||||
factory Rancher.fromJson(Map<String, dynamic> json) => _$RancherFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Herd with _$Herd {
|
||||
const factory Herd({Location? location, String? address, String? image}) = _Herd;
|
||||
|
||||
factory Herd.fromJson(Map<String, dynamic> json) => _$HerdFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Location with _$Location {
|
||||
const factory Location({double? lat, double? lng}) = _Location;
|
||||
|
||||
factory Location.fromJson(Map<String, dynamic> json) => _$LocationFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Livestock with _$Livestock {
|
||||
const factory Livestock({
|
||||
String? species,
|
||||
String? breed,
|
||||
String? dateOfBirth,
|
||||
String? sex,
|
||||
String? motherTag,
|
||||
String? fatherTag,
|
||||
String? tagNumber,
|
||||
String? tagType,
|
||||
String? image,
|
||||
}) = _Livestock;
|
||||
|
||||
factory Livestock.fromJson(Map<String, dynamic> json) => _$LivestockFromJson(json);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,88 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'livestock_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_LivestockData _$LivestockDataFromJson(Map<String, dynamic> json) =>
|
||||
_LivestockData(
|
||||
rancher: json['rancher'] == null
|
||||
? null
|
||||
: Rancher.fromJson(json['rancher'] as Map<String, dynamic>),
|
||||
herd: json['herd'] == null
|
||||
? null
|
||||
: Herd.fromJson(json['herd'] as Map<String, dynamic>),
|
||||
livestock: (json['livestock'] as List<dynamic>?)
|
||||
?.map((e) => Livestock.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LivestockDataToJson(_LivestockData instance) =>
|
||||
<String, dynamic>{
|
||||
'rancher': instance.rancher,
|
||||
'herd': instance.herd,
|
||||
'livestock': instance.livestock,
|
||||
};
|
||||
|
||||
_Rancher _$RancherFromJson(Map<String, dynamic> json) => _Rancher(
|
||||
name: json['name'] as String?,
|
||||
phone: json['phone'] as String?,
|
||||
image: json['image'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RancherToJson(_Rancher instance) => <String, dynamic>{
|
||||
'name': instance.name,
|
||||
'phone': instance.phone,
|
||||
'image': instance.image,
|
||||
};
|
||||
|
||||
_Herd _$HerdFromJson(Map<String, dynamic> json) => _Herd(
|
||||
location: json['location'] == null
|
||||
? null
|
||||
: Location.fromJson(json['location'] as Map<String, dynamic>),
|
||||
address: json['address'] as String?,
|
||||
image: json['image'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$HerdToJson(_Herd instance) => <String, dynamic>{
|
||||
'location': instance.location,
|
||||
'address': instance.address,
|
||||
'image': instance.image,
|
||||
};
|
||||
|
||||
_Location _$LocationFromJson(Map<String, dynamic> json) => _Location(
|
||||
lat: (json['lat'] as num?)?.toDouble(),
|
||||
lng: (json['lng'] as num?)?.toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LocationToJson(_Location instance) => <String, dynamic>{
|
||||
'lat': instance.lat,
|
||||
'lng': instance.lng,
|
||||
};
|
||||
|
||||
_Livestock _$LivestockFromJson(Map<String, dynamic> json) => _Livestock(
|
||||
species: json['species'] as String?,
|
||||
breed: json['breed'] as String?,
|
||||
dateOfBirth: json['date_of_birth'] as String?,
|
||||
sex: json['sex'] as String?,
|
||||
motherTag: json['mother_tag'] as String?,
|
||||
fatherTag: json['father_tag'] as String?,
|
||||
tagNumber: json['tag_number'] as String?,
|
||||
tagType: json['tag_type'] as String?,
|
||||
image: json['image'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LivestockToJson(_Livestock instance) =>
|
||||
<String, dynamic>{
|
||||
'species': instance.species,
|
||||
'breed': instance.breed,
|
||||
'date_of_birth': instance.dateOfBirth,
|
||||
'sex': instance.sex,
|
||||
'mother_tag': instance.motherTag,
|
||||
'father_tag': instance.fatherTag,
|
||||
'tag_number': instance.tagNumber,
|
||||
'tag_type': instance.tagType,
|
||||
'image': instance.image,
|
||||
};
|
||||
Reference in New Issue
Block a user