Compare commits

...

1 Commits

Author SHA1 Message Date
Adam Gastineau
a5a981545c chore(mobile): example freezed implementation on some models 2026-07-23 11:07:09 -07:00
7 changed files with 723 additions and 308 deletions

3
.gitattributes vendored
View File

@@ -15,6 +15,9 @@ mobile/ios/**/*.g.swift linguist-generated=true
mobile/lib/**/*.drift.dart -diff -merge
mobile/lib/**/*.drift.dart linguist-generated=true
mobile/lib/**/*.freezed.dart -diff -merge
mobile/lib/**/*.freezed.dart linguist-generated=true
mobile/drift_schemas/main/drift_schema_*.json -diff -merge
mobile/drift_schemas/main/drift_schema_*.json linguist-generated=true

View File

@@ -1,30 +1,39 @@
class ExifInfo {
final int? assetId;
final int? fileSize;
final String? description;
final bool isFlipped;
final String? orientation;
final String? timeZone;
final DateTime? dateTimeOriginal;
final int? rating;
final int? width;
final int? height;
import 'package:freezed_annotation/freezed_annotation.dart';
// GPS
final double? latitude;
final double? longitude;
final String? city;
final String? state;
final String? country;
part 'exif.model.freezed.dart';
// Camera related
final String? make;
final String? model;
final String? lens;
final double? f;
final double? mm;
final int? iso;
final double? exposureSeconds;
@freezed
abstract class ExifInfo with _$ExifInfo {
const ExifInfo._();
const factory ExifInfo({
int? assetId,
int? fileSize,
String? description,
@Default(false) bool isFlipped,
String? orientation,
String? timeZone,
DateTime? dateTimeOriginal,
int? rating,
int? width,
int? height,
// GPS
double? latitude,
double? longitude,
String? city,
String? state,
String? country,
// Camera related
String? make,
String? model,
String? lens,
double? f,
double? mm,
int? iso,
double? exposureSeconds,
}) = _ExifInfo;
bool get hasCoordinates => latitude != null && longitude != null && latitude != 0 && longitude != 0;
@@ -41,162 +50,4 @@ class ExifInfo {
String get fNumber => f == null ? "" : f!.toStringAsFixed(1);
String get focalLength => mm == null ? "" : mm!.toStringAsFixed(3);
const ExifInfo({
this.assetId,
this.fileSize,
this.description,
this.orientation,
this.timeZone,
this.dateTimeOriginal,
this.rating,
this.width,
this.height,
this.isFlipped = false,
this.latitude,
this.longitude,
this.city,
this.state,
this.country,
this.make,
this.model,
this.lens,
this.f,
this.mm,
this.iso,
this.exposureSeconds,
});
@override
bool operator ==(covariant ExifInfo other) {
if (identical(this, other)) {
return true;
}
return other.fileSize == fileSize &&
other.description == description &&
other.isFlipped == isFlipped &&
other.orientation == orientation &&
other.timeZone == timeZone &&
other.dateTimeOriginal == dateTimeOriginal &&
other.rating == rating &&
other.width == width &&
other.height == height &&
other.latitude == latitude &&
other.longitude == longitude &&
other.city == city &&
other.state == state &&
other.country == country &&
other.make == make &&
other.model == model &&
other.lens == lens &&
other.f == f &&
other.mm == mm &&
other.iso == iso &&
other.exposureSeconds == exposureSeconds &&
other.assetId == assetId;
}
@override
int get hashCode {
return fileSize.hashCode ^
description.hashCode ^
orientation.hashCode ^
isFlipped.hashCode ^
timeZone.hashCode ^
dateTimeOriginal.hashCode ^
rating.hashCode ^
width.hashCode ^
height.hashCode ^
latitude.hashCode ^
longitude.hashCode ^
city.hashCode ^
state.hashCode ^
country.hashCode ^
make.hashCode ^
model.hashCode ^
lens.hashCode ^
f.hashCode ^
mm.hashCode ^
iso.hashCode ^
exposureSeconds.hashCode ^
assetId.hashCode;
}
@override
String toString() {
return '''{
fileSize: ${fileSize ?? 'NA'},
description: ${description ?? 'NA'},
orientation: ${orientation ?? 'NA'},
isFlipped: $isFlipped,
timeZone: ${timeZone ?? 'NA'},
dateTimeOriginal: ${dateTimeOriginal ?? 'NA'},
rating: ${rating ?? 'NA'},
width: ${width ?? 'NA'},
height: ${height ?? 'NA'},
latitude: ${latitude ?? 'NA'},
longitude: ${longitude ?? 'NA'},
city: ${city ?? 'NA'},
state: ${state ?? 'NA'},
country: ${country ?? '<NA>'},
make: ${make ?? 'NA'},
model: ${model ?? 'NA'},
lens: ${lens ?? 'NA'},
f: ${f ?? 'NA'},
mm: ${mm ?? '<NA>'},
iso: ${iso ?? 'NA'},
exposureSeconds: ${exposureSeconds ?? 'NA'},
}''';
}
ExifInfo copyWith({
int? assetId,
int? fileSize,
String? description,
String? orientation,
String? timeZone,
DateTime? dateTimeOriginal,
int? rating,
int? width,
int? height,
double? latitude,
double? longitude,
String? city,
String? state,
String? country,
bool? isFlipped,
String? make,
String? model,
String? lens,
double? f,
double? mm,
int? iso,
double? exposureSeconds,
}) {
return ExifInfo(
assetId: assetId ?? this.assetId,
fileSize: fileSize ?? this.fileSize,
description: description ?? this.description,
orientation: orientation ?? this.orientation,
timeZone: timeZone ?? this.timeZone,
dateTimeOriginal: dateTimeOriginal ?? this.dateTimeOriginal,
rating: rating ?? this.rating,
width: width ?? this.width,
height: height ?? this.height,
isFlipped: isFlipped ?? this.isFlipped,
latitude: latitude ?? this.latitude,
longitude: longitude ?? this.longitude,
city: city ?? this.city,
state: state ?? this.state,
country: country ?? this.country,
make: make ?? this.make,
model: model ?? this.model,
lens: lens ?? this.lens,
f: f ?? this.f,
mm: mm ?? this.mm,
iso: iso ?? this.iso,
exposureSeconds: exposureSeconds ?? this.exposureSeconds,
);
}
}

View File

@@ -0,0 +1,338 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'exif.model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ExifInfo {
int? get assetId; int? get fileSize; String? get description; bool get isFlipped; String? get orientation; String? get timeZone; DateTime? get dateTimeOriginal; int? get rating; int? get width; int? get height;// GPS
double? get latitude; double? get longitude; String? get city; String? get state; String? get country;// Camera related
String? get make; String? get model; String? get lens; double? get f; double? get mm; int? get iso; double? get exposureSeconds;
/// Create a copy of ExifInfo
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ExifInfoCopyWith<ExifInfo> get copyWith => _$ExifInfoCopyWithImpl<ExifInfo>(this as ExifInfo, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ExifInfo&&(identical(other.assetId, assetId) || other.assetId == assetId)&&(identical(other.fileSize, fileSize) || other.fileSize == fileSize)&&(identical(other.description, description) || other.description == description)&&(identical(other.isFlipped, isFlipped) || other.isFlipped == isFlipped)&&(identical(other.orientation, orientation) || other.orientation == orientation)&&(identical(other.timeZone, timeZone) || other.timeZone == timeZone)&&(identical(other.dateTimeOriginal, dateTimeOriginal) || other.dateTimeOriginal == dateTimeOriginal)&&(identical(other.rating, rating) || other.rating == rating)&&(identical(other.width, width) || other.width == width)&&(identical(other.height, height) || other.height == height)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.city, city) || other.city == city)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.make, make) || other.make == make)&&(identical(other.model, model) || other.model == model)&&(identical(other.lens, lens) || other.lens == lens)&&(identical(other.f, f) || other.f == f)&&(identical(other.mm, mm) || other.mm == mm)&&(identical(other.iso, iso) || other.iso == iso)&&(identical(other.exposureSeconds, exposureSeconds) || other.exposureSeconds == exposureSeconds));
}
@override
int get hashCode => Object.hashAll([runtimeType,assetId,fileSize,description,isFlipped,orientation,timeZone,dateTimeOriginal,rating,width,height,latitude,longitude,city,state,country,make,model,lens,f,mm,iso,exposureSeconds]);
@override
String toString() {
return 'ExifInfo(assetId: $assetId, fileSize: $fileSize, description: $description, isFlipped: $isFlipped, orientation: $orientation, timeZone: $timeZone, dateTimeOriginal: $dateTimeOriginal, rating: $rating, width: $width, height: $height, latitude: $latitude, longitude: $longitude, city: $city, state: $state, country: $country, make: $make, model: $model, lens: $lens, f: $f, mm: $mm, iso: $iso, exposureSeconds: $exposureSeconds)';
}
}
/// @nodoc
abstract mixin class $ExifInfoCopyWith<$Res> {
factory $ExifInfoCopyWith(ExifInfo value, $Res Function(ExifInfo) _then) = _$ExifInfoCopyWithImpl;
@useResult
$Res call({
int? assetId, int? fileSize, String? description, bool isFlipped, String? orientation, String? timeZone, DateTime? dateTimeOriginal, int? rating, int? width, int? height, double? latitude, double? longitude, String? city, String? state, String? country, String? make, String? model, String? lens, double? f, double? mm, int? iso, double? exposureSeconds
});
}
/// @nodoc
class _$ExifInfoCopyWithImpl<$Res>
implements $ExifInfoCopyWith<$Res> {
_$ExifInfoCopyWithImpl(this._self, this._then);
final ExifInfo _self;
final $Res Function(ExifInfo) _then;
/// Create a copy of ExifInfo
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? assetId = freezed,Object? fileSize = freezed,Object? description = freezed,Object? isFlipped = null,Object? orientation = freezed,Object? timeZone = freezed,Object? dateTimeOriginal = freezed,Object? rating = freezed,Object? width = freezed,Object? height = freezed,Object? latitude = freezed,Object? longitude = freezed,Object? city = freezed,Object? state = freezed,Object? country = freezed,Object? make = freezed,Object? model = freezed,Object? lens = freezed,Object? f = freezed,Object? mm = freezed,Object? iso = freezed,Object? exposureSeconds = freezed,}) {
return _then(_self.copyWith(
assetId: freezed == assetId ? _self.assetId : assetId // ignore: cast_nullable_to_non_nullable
as int?,fileSize: freezed == fileSize ? _self.fileSize : fileSize // ignore: cast_nullable_to_non_nullable
as int?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
as String?,isFlipped: null == isFlipped ? _self.isFlipped : isFlipped // ignore: cast_nullable_to_non_nullable
as bool,orientation: freezed == orientation ? _self.orientation : orientation // ignore: cast_nullable_to_non_nullable
as String?,timeZone: freezed == timeZone ? _self.timeZone : timeZone // ignore: cast_nullable_to_non_nullable
as String?,dateTimeOriginal: freezed == dateTimeOriginal ? _self.dateTimeOriginal : dateTimeOriginal // ignore: cast_nullable_to_non_nullable
as DateTime?,rating: freezed == rating ? _self.rating : rating // ignore: cast_nullable_to_non_nullable
as int?,width: freezed == width ? _self.width : width // ignore: cast_nullable_to_non_nullable
as int?,height: freezed == height ? _self.height : height // ignore: cast_nullable_to_non_nullable
as int?,latitude: freezed == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
as double?,longitude: freezed == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
as double?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,make: freezed == make ? _self.make : make // ignore: cast_nullable_to_non_nullable
as String?,model: freezed == model ? _self.model : model // ignore: cast_nullable_to_non_nullable
as String?,lens: freezed == lens ? _self.lens : lens // ignore: cast_nullable_to_non_nullable
as String?,f: freezed == f ? _self.f : f // ignore: cast_nullable_to_non_nullable
as double?,mm: freezed == mm ? _self.mm : mm // ignore: cast_nullable_to_non_nullable
as double?,iso: freezed == iso ? _self.iso : iso // ignore: cast_nullable_to_non_nullable
as int?,exposureSeconds: freezed == exposureSeconds ? _self.exposureSeconds : exposureSeconds // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
/// Adds pattern-matching-related methods to [ExifInfo].
extension ExifInfoPatterns on ExifInfo {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ExifInfo value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ExifInfo() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ExifInfo value) $default,){
final _that = this;
switch (_that) {
case _ExifInfo():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ExifInfo value)? $default,){
final _that = this;
switch (_that) {
case _ExifInfo() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? assetId, int? fileSize, String? description, bool isFlipped, String? orientation, String? timeZone, DateTime? dateTimeOriginal, int? rating, int? width, int? height, double? latitude, double? longitude, String? city, String? state, String? country, String? make, String? model, String? lens, double? f, double? mm, int? iso, double? exposureSeconds)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ExifInfo() when $default != null:
return $default(_that.assetId,_that.fileSize,_that.description,_that.isFlipped,_that.orientation,_that.timeZone,_that.dateTimeOriginal,_that.rating,_that.width,_that.height,_that.latitude,_that.longitude,_that.city,_that.state,_that.country,_that.make,_that.model,_that.lens,_that.f,_that.mm,_that.iso,_that.exposureSeconds);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? assetId, int? fileSize, String? description, bool isFlipped, String? orientation, String? timeZone, DateTime? dateTimeOriginal, int? rating, int? width, int? height, double? latitude, double? longitude, String? city, String? state, String? country, String? make, String? model, String? lens, double? f, double? mm, int? iso, double? exposureSeconds) $default,) {final _that = this;
switch (_that) {
case _ExifInfo():
return $default(_that.assetId,_that.fileSize,_that.description,_that.isFlipped,_that.orientation,_that.timeZone,_that.dateTimeOriginal,_that.rating,_that.width,_that.height,_that.latitude,_that.longitude,_that.city,_that.state,_that.country,_that.make,_that.model,_that.lens,_that.f,_that.mm,_that.iso,_that.exposureSeconds);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? assetId, int? fileSize, String? description, bool isFlipped, String? orientation, String? timeZone, DateTime? dateTimeOriginal, int? rating, int? width, int? height, double? latitude, double? longitude, String? city, String? state, String? country, String? make, String? model, String? lens, double? f, double? mm, int? iso, double? exposureSeconds)? $default,) {final _that = this;
switch (_that) {
case _ExifInfo() when $default != null:
return $default(_that.assetId,_that.fileSize,_that.description,_that.isFlipped,_that.orientation,_that.timeZone,_that.dateTimeOriginal,_that.rating,_that.width,_that.height,_that.latitude,_that.longitude,_that.city,_that.state,_that.country,_that.make,_that.model,_that.lens,_that.f,_that.mm,_that.iso,_that.exposureSeconds);case _:
return null;
}
}
}
/// @nodoc
class _ExifInfo extends ExifInfo {
const _ExifInfo({this.assetId, this.fileSize, this.description, this.isFlipped = false, this.orientation, this.timeZone, this.dateTimeOriginal, this.rating, this.width, this.height, this.latitude, this.longitude, this.city, this.state, this.country, this.make, this.model, this.lens, this.f, this.mm, this.iso, this.exposureSeconds}): super._();
@override final int? assetId;
@override final int? fileSize;
@override final String? description;
@override@JsonKey() final bool isFlipped;
@override final String? orientation;
@override final String? timeZone;
@override final DateTime? dateTimeOriginal;
@override final int? rating;
@override final int? width;
@override final int? height;
// GPS
@override final double? latitude;
@override final double? longitude;
@override final String? city;
@override final String? state;
@override final String? country;
// Camera related
@override final String? make;
@override final String? model;
@override final String? lens;
@override final double? f;
@override final double? mm;
@override final int? iso;
@override final double? exposureSeconds;
/// Create a copy of ExifInfo
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ExifInfoCopyWith<_ExifInfo> get copyWith => __$ExifInfoCopyWithImpl<_ExifInfo>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ExifInfo&&(identical(other.assetId, assetId) || other.assetId == assetId)&&(identical(other.fileSize, fileSize) || other.fileSize == fileSize)&&(identical(other.description, description) || other.description == description)&&(identical(other.isFlipped, isFlipped) || other.isFlipped == isFlipped)&&(identical(other.orientation, orientation) || other.orientation == orientation)&&(identical(other.timeZone, timeZone) || other.timeZone == timeZone)&&(identical(other.dateTimeOriginal, dateTimeOriginal) || other.dateTimeOriginal == dateTimeOriginal)&&(identical(other.rating, rating) || other.rating == rating)&&(identical(other.width, width) || other.width == width)&&(identical(other.height, height) || other.height == height)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.city, city) || other.city == city)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.make, make) || other.make == make)&&(identical(other.model, model) || other.model == model)&&(identical(other.lens, lens) || other.lens == lens)&&(identical(other.f, f) || other.f == f)&&(identical(other.mm, mm) || other.mm == mm)&&(identical(other.iso, iso) || other.iso == iso)&&(identical(other.exposureSeconds, exposureSeconds) || other.exposureSeconds == exposureSeconds));
}
@override
int get hashCode => Object.hashAll([runtimeType,assetId,fileSize,description,isFlipped,orientation,timeZone,dateTimeOriginal,rating,width,height,latitude,longitude,city,state,country,make,model,lens,f,mm,iso,exposureSeconds]);
@override
String toString() {
return 'ExifInfo(assetId: $assetId, fileSize: $fileSize, description: $description, isFlipped: $isFlipped, orientation: $orientation, timeZone: $timeZone, dateTimeOriginal: $dateTimeOriginal, rating: $rating, width: $width, height: $height, latitude: $latitude, longitude: $longitude, city: $city, state: $state, country: $country, make: $make, model: $model, lens: $lens, f: $f, mm: $mm, iso: $iso, exposureSeconds: $exposureSeconds)';
}
}
/// @nodoc
abstract mixin class _$ExifInfoCopyWith<$Res> implements $ExifInfoCopyWith<$Res> {
factory _$ExifInfoCopyWith(_ExifInfo value, $Res Function(_ExifInfo) _then) = __$ExifInfoCopyWithImpl;
@override @useResult
$Res call({
int? assetId, int? fileSize, String? description, bool isFlipped, String? orientation, String? timeZone, DateTime? dateTimeOriginal, int? rating, int? width, int? height, double? latitude, double? longitude, String? city, String? state, String? country, String? make, String? model, String? lens, double? f, double? mm, int? iso, double? exposureSeconds
});
}
/// @nodoc
class __$ExifInfoCopyWithImpl<$Res>
implements _$ExifInfoCopyWith<$Res> {
__$ExifInfoCopyWithImpl(this._self, this._then);
final _ExifInfo _self;
final $Res Function(_ExifInfo) _then;
/// Create a copy of ExifInfo
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? assetId = freezed,Object? fileSize = freezed,Object? description = freezed,Object? isFlipped = null,Object? orientation = freezed,Object? timeZone = freezed,Object? dateTimeOriginal = freezed,Object? rating = freezed,Object? width = freezed,Object? height = freezed,Object? latitude = freezed,Object? longitude = freezed,Object? city = freezed,Object? state = freezed,Object? country = freezed,Object? make = freezed,Object? model = freezed,Object? lens = freezed,Object? f = freezed,Object? mm = freezed,Object? iso = freezed,Object? exposureSeconds = freezed,}) {
return _then(_ExifInfo(
assetId: freezed == assetId ? _self.assetId : assetId // ignore: cast_nullable_to_non_nullable
as int?,fileSize: freezed == fileSize ? _self.fileSize : fileSize // ignore: cast_nullable_to_non_nullable
as int?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
as String?,isFlipped: null == isFlipped ? _self.isFlipped : isFlipped // ignore: cast_nullable_to_non_nullable
as bool,orientation: freezed == orientation ? _self.orientation : orientation // ignore: cast_nullable_to_non_nullable
as String?,timeZone: freezed == timeZone ? _self.timeZone : timeZone // ignore: cast_nullable_to_non_nullable
as String?,dateTimeOriginal: freezed == dateTimeOriginal ? _self.dateTimeOriginal : dateTimeOriginal // ignore: cast_nullable_to_non_nullable
as DateTime?,rating: freezed == rating ? _self.rating : rating // ignore: cast_nullable_to_non_nullable
as int?,width: freezed == width ? _self.width : width // ignore: cast_nullable_to_non_nullable
as int?,height: freezed == height ? _self.height : height // ignore: cast_nullable_to_non_nullable
as int?,latitude: freezed == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
as double?,longitude: freezed == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
as double?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,make: freezed == make ? _self.make : make // ignore: cast_nullable_to_non_nullable
as String?,model: freezed == model ? _self.model : model // ignore: cast_nullable_to_non_nullable
as String?,lens: freezed == lens ? _self.lens : lens // ignore: cast_nullable_to_non_nullable
as String?,f: freezed == f ? _self.f : f // ignore: cast_nullable_to_non_nullable
as double?,mm: freezed == mm ? _self.mm : mm // ignore: cast_nullable_to_non_nullable
as double?,iso: freezed == iso ? _self.iso : iso // ignore: cast_nullable_to_non_nullable
as int?,exposureSeconds: freezed == exposureSeconds ? _self.exposureSeconds : exposureSeconds // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
// dart format on

View File

@@ -1,128 +1,23 @@
class Ocr {
final String id;
final String assetId;
final double x1;
final double y1;
final double x2;
final double y2;
final double x3;
final double y3;
final double x4;
final double y4;
final double boxScore;
final double textScore;
final String text;
final bool isVisible;
import 'package:freezed_annotation/freezed_annotation.dart';
const Ocr({
required this.id,
required this.assetId,
required this.x1,
required this.y1,
required this.x2,
required this.y2,
required this.x3,
required this.y3,
required this.x4,
required this.y4,
required this.boxScore,
required this.textScore,
required this.text,
required this.isVisible,
});
part 'ocr.model.freezed.dart';
Ocr copyWith({
String? id,
String? assetId,
double? x1,
double? y1,
double? x2,
double? y2,
double? x3,
double? y3,
double? x4,
double? y4,
double? boxScore,
double? textScore,
String? text,
bool? isVisible,
}) {
return Ocr(
id: id ?? this.id,
assetId: assetId ?? this.assetId,
x1: x1 ?? this.x1,
y1: y1 ?? this.y1,
x2: x2 ?? this.x2,
y2: y2 ?? this.y2,
x3: x3 ?? this.x3,
y3: y3 ?? this.y3,
x4: x4 ?? this.x4,
y4: y4 ?? this.y4,
boxScore: boxScore ?? this.boxScore,
textScore: textScore ?? this.textScore,
text: text ?? this.text,
isVisible: isVisible ?? this.isVisible,
);
}
@override
String toString() {
return '''Ocr {
id: $id,
assetId: $assetId,
x1: $x1,
y1: $y1,
x2: $x2,
y2: $y2,
x3: $x3,
y3: $y3,
x4: $x4,
y4: $y4,
boxScore: $boxScore,
textScore: $textScore,
text: $text,
isVisible: $isVisible
}''';
}
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
return other is Ocr &&
other.id == id &&
other.assetId == assetId &&
other.x1 == x1 &&
other.y1 == y1 &&
other.x2 == x2 &&
other.y2 == y2 &&
other.x3 == x3 &&
other.y3 == y3 &&
other.x4 == x4 &&
other.y4 == y4 &&
other.boxScore == boxScore &&
other.textScore == textScore &&
other.text == text &&
other.isVisible == isVisible;
}
@override
int get hashCode {
return id.hashCode ^
assetId.hashCode ^
x1.hashCode ^
y1.hashCode ^
x2.hashCode ^
y2.hashCode ^
x3.hashCode ^
y3.hashCode ^
x4.hashCode ^
y4.hashCode ^
boxScore.hashCode ^
textScore.hashCode ^
text.hashCode ^
isVisible.hashCode;
}
@freezed
abstract class Ocr with _$Ocr {
const factory Ocr({
required String id,
required String assetId,
required double x1,
required double y1,
required double x2,
required double y2,
required double x3,
required double y3,
required double x4,
required double y4,
required double boxScore,
required double textScore,
required String text,
required bool isVisible,
}) = _Ocr;
}

View File

@@ -0,0 +1,310 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'ocr.model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$Ocr {
String get id; String get assetId; double get x1; double get y1; double get x2; double get y2; double get x3; double get y3; double get x4; double get y4; double get boxScore; double get textScore; String get text; bool get isVisible;
/// Create a copy of Ocr
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$OcrCopyWith<Ocr> get copyWith => _$OcrCopyWithImpl<Ocr>(this as Ocr, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Ocr&&(identical(other.id, id) || other.id == id)&&(identical(other.assetId, assetId) || other.assetId == assetId)&&(identical(other.x1, x1) || other.x1 == x1)&&(identical(other.y1, y1) || other.y1 == y1)&&(identical(other.x2, x2) || other.x2 == x2)&&(identical(other.y2, y2) || other.y2 == y2)&&(identical(other.x3, x3) || other.x3 == x3)&&(identical(other.y3, y3) || other.y3 == y3)&&(identical(other.x4, x4) || other.x4 == x4)&&(identical(other.y4, y4) || other.y4 == y4)&&(identical(other.boxScore, boxScore) || other.boxScore == boxScore)&&(identical(other.textScore, textScore) || other.textScore == textScore)&&(identical(other.text, text) || other.text == text)&&(identical(other.isVisible, isVisible) || other.isVisible == isVisible));
}
@override
int get hashCode => Object.hash(runtimeType,id,assetId,x1,y1,x2,y2,x3,y3,x4,y4,boxScore,textScore,text,isVisible);
@override
String toString() {
return 'Ocr(id: $id, assetId: $assetId, x1: $x1, y1: $y1, x2: $x2, y2: $y2, x3: $x3, y3: $y3, x4: $x4, y4: $y4, boxScore: $boxScore, textScore: $textScore, text: $text, isVisible: $isVisible)';
}
}
/// @nodoc
abstract mixin class $OcrCopyWith<$Res> {
factory $OcrCopyWith(Ocr value, $Res Function(Ocr) _then) = _$OcrCopyWithImpl;
@useResult
$Res call({
String id, String assetId, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double boxScore, double textScore, String text, bool isVisible
});
}
/// @nodoc
class _$OcrCopyWithImpl<$Res>
implements $OcrCopyWith<$Res> {
_$OcrCopyWithImpl(this._self, this._then);
final Ocr _self;
final $Res Function(Ocr) _then;
/// Create a copy of Ocr
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? assetId = null,Object? x1 = null,Object? y1 = null,Object? x2 = null,Object? y2 = null,Object? x3 = null,Object? y3 = null,Object? x4 = null,Object? y4 = null,Object? boxScore = null,Object? textScore = null,Object? text = null,Object? isVisible = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,assetId: null == assetId ? _self.assetId : assetId // ignore: cast_nullable_to_non_nullable
as String,x1: null == x1 ? _self.x1 : x1 // ignore: cast_nullable_to_non_nullable
as double,y1: null == y1 ? _self.y1 : y1 // ignore: cast_nullable_to_non_nullable
as double,x2: null == x2 ? _self.x2 : x2 // ignore: cast_nullable_to_non_nullable
as double,y2: null == y2 ? _self.y2 : y2 // ignore: cast_nullable_to_non_nullable
as double,x3: null == x3 ? _self.x3 : x3 // ignore: cast_nullable_to_non_nullable
as double,y3: null == y3 ? _self.y3 : y3 // ignore: cast_nullable_to_non_nullable
as double,x4: null == x4 ? _self.x4 : x4 // ignore: cast_nullable_to_non_nullable
as double,y4: null == y4 ? _self.y4 : y4 // ignore: cast_nullable_to_non_nullable
as double,boxScore: null == boxScore ? _self.boxScore : boxScore // ignore: cast_nullable_to_non_nullable
as double,textScore: null == textScore ? _self.textScore : textScore // ignore: cast_nullable_to_non_nullable
as double,text: null == text ? _self.text : text // ignore: cast_nullable_to_non_nullable
as String,isVisible: null == isVisible ? _self.isVisible : isVisible // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// Adds pattern-matching-related methods to [Ocr].
extension OcrPatterns on Ocr {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _Ocr value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _Ocr() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _Ocr value) $default,){
final _that = this;
switch (_that) {
case _Ocr():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _Ocr value)? $default,){
final _that = this;
switch (_that) {
case _Ocr() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String assetId, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double boxScore, double textScore, String text, bool isVisible)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Ocr() when $default != null:
return $default(_that.id,_that.assetId,_that.x1,_that.y1,_that.x2,_that.y2,_that.x3,_that.y3,_that.x4,_that.y4,_that.boxScore,_that.textScore,_that.text,_that.isVisible);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String assetId, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double boxScore, double textScore, String text, bool isVisible) $default,) {final _that = this;
switch (_that) {
case _Ocr():
return $default(_that.id,_that.assetId,_that.x1,_that.y1,_that.x2,_that.y2,_that.x3,_that.y3,_that.x4,_that.y4,_that.boxScore,_that.textScore,_that.text,_that.isVisible);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String assetId, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double boxScore, double textScore, String text, bool isVisible)? $default,) {final _that = this;
switch (_that) {
case _Ocr() when $default != null:
return $default(_that.id,_that.assetId,_that.x1,_that.y1,_that.x2,_that.y2,_that.x3,_that.y3,_that.x4,_that.y4,_that.boxScore,_that.textScore,_that.text,_that.isVisible);case _:
return null;
}
}
}
/// @nodoc
class _Ocr implements Ocr {
const _Ocr({required this.id, required this.assetId, required this.x1, required this.y1, required this.x2, required this.y2, required this.x3, required this.y3, required this.x4, required this.y4, required this.boxScore, required this.textScore, required this.text, required this.isVisible});
@override final String id;
@override final String assetId;
@override final double x1;
@override final double y1;
@override final double x2;
@override final double y2;
@override final double x3;
@override final double y3;
@override final double x4;
@override final double y4;
@override final double boxScore;
@override final double textScore;
@override final String text;
@override final bool isVisible;
/// Create a copy of Ocr
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$OcrCopyWith<_Ocr> get copyWith => __$OcrCopyWithImpl<_Ocr>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Ocr&&(identical(other.id, id) || other.id == id)&&(identical(other.assetId, assetId) || other.assetId == assetId)&&(identical(other.x1, x1) || other.x1 == x1)&&(identical(other.y1, y1) || other.y1 == y1)&&(identical(other.x2, x2) || other.x2 == x2)&&(identical(other.y2, y2) || other.y2 == y2)&&(identical(other.x3, x3) || other.x3 == x3)&&(identical(other.y3, y3) || other.y3 == y3)&&(identical(other.x4, x4) || other.x4 == x4)&&(identical(other.y4, y4) || other.y4 == y4)&&(identical(other.boxScore, boxScore) || other.boxScore == boxScore)&&(identical(other.textScore, textScore) || other.textScore == textScore)&&(identical(other.text, text) || other.text == text)&&(identical(other.isVisible, isVisible) || other.isVisible == isVisible));
}
@override
int get hashCode => Object.hash(runtimeType,id,assetId,x1,y1,x2,y2,x3,y3,x4,y4,boxScore,textScore,text,isVisible);
@override
String toString() {
return 'Ocr(id: $id, assetId: $assetId, x1: $x1, y1: $y1, x2: $x2, y2: $y2, x3: $x3, y3: $y3, x4: $x4, y4: $y4, boxScore: $boxScore, textScore: $textScore, text: $text, isVisible: $isVisible)';
}
}
/// @nodoc
abstract mixin class _$OcrCopyWith<$Res> implements $OcrCopyWith<$Res> {
factory _$OcrCopyWith(_Ocr value, $Res Function(_Ocr) _then) = __$OcrCopyWithImpl;
@override @useResult
$Res call({
String id, String assetId, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double boxScore, double textScore, String text, bool isVisible
});
}
/// @nodoc
class __$OcrCopyWithImpl<$Res>
implements _$OcrCopyWith<$Res> {
__$OcrCopyWithImpl(this._self, this._then);
final _Ocr _self;
final $Res Function(_Ocr) _then;
/// Create a copy of Ocr
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? assetId = null,Object? x1 = null,Object? y1 = null,Object? x2 = null,Object? y2 = null,Object? x3 = null,Object? y3 = null,Object? x4 = null,Object? y4 = null,Object? boxScore = null,Object? textScore = null,Object? text = null,Object? isVisible = null,}) {
return _then(_Ocr(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,assetId: null == assetId ? _self.assetId : assetId // ignore: cast_nullable_to_non_nullable
as String,x1: null == x1 ? _self.x1 : x1 // ignore: cast_nullable_to_non_nullable
as double,y1: null == y1 ? _self.y1 : y1 // ignore: cast_nullable_to_non_nullable
as double,x2: null == x2 ? _self.x2 : x2 // ignore: cast_nullable_to_non_nullable
as double,y2: null == y2 ? _self.y2 : y2 // ignore: cast_nullable_to_non_nullable
as double,x3: null == x3 ? _self.x3 : x3 // ignore: cast_nullable_to_non_nullable
as double,y3: null == y3 ? _self.y3 : y3 // ignore: cast_nullable_to_non_nullable
as double,x4: null == x4 ? _self.x4 : x4 // ignore: cast_nullable_to_non_nullable
as double,y4: null == y4 ? _self.y4 : y4 // ignore: cast_nullable_to_non_nullable
as double,boxScore: null == boxScore ? _self.boxScore : boxScore // ignore: cast_nullable_to_non_nullable
as double,textScore: null == textScore ? _self.textScore : textScore // ignore: cast_nullable_to_non_nullable
as double,text: null == text ? _self.text : text // ignore: cast_nullable_to_non_nullable
as String,isVisible: null == isVisible ? _self.isVisible : isVisible // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View File

@@ -667,6 +667,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.2.14"
freezed:
dependency: "direct dev"
description:
name: freezed
sha256: f23ea33b3863f119b58ed1b586e881a46bd28715ddcc4dbc33104524e3434131
url: "https://pub.dev"
source: hosted
version: "3.2.5"
freezed_annotation:
dependency: "direct main"
description:
name: freezed_annotation
sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
frontend_server_client:
dependency: transitive
description:

View File

@@ -91,6 +91,7 @@ dependencies:
url: https://github.com/mertalev/http
ref: '549c24b0a4d3881a9a44b70f4873450d43c1c4af' # https://github.com/dart-lang/http/pull/1877
path: pkgs/ok_http/
freezed_annotation: ^3.1.0
dev_dependencies:
auto_route_generator: ^10.5.0
@@ -104,6 +105,7 @@ dev_dependencies:
flutter_native_splash: ^2.4.7
flutter_test:
sdk: flutter
freezed: ^3.2.5
integration_test:
sdk: flutter
mocktail: ^1.0.5