chore(wip): upgrade dependencies, begin refactor

This commit is contained in:
2025-12-23 21:49:54 +01:00
parent 0070e57aec
commit 239b63ca81
82 changed files with 4028 additions and 195 deletions

View File

@@ -0,0 +1,24 @@
# Domain layer
## `entities` - Model definition
Since we follow the repository structure convention, in this folder we purely define data models, without providing any logic. To reduce boilerplate, we use the `freezed` package. This requires some code generation, which means that all model definitions have the following structure:
```dart
import 'package:freezed_annotation/freezed_annotation.dart';
// required: associates our `main.dart` with the code generated by Freezed
part 'main.freezed.dart';
// optional: Since our Person class is serializable, we must add this line.
// But if Person was not serializable, we could skip it.
part 'main.g.dart';
```
This is required boilerplate for all models. Then, we define the model itself using the `@freezed` annotation:
```dart
@freezed
...
```
The `*.frozen.dart` and `*.g.dart` are pure boilerplate and should not be touched.
Note that the description of the data will losely follow the capabilities of the backend but does not need to reflect it exactly. That is where the `data` part is for: translating api calls into flutter objects.

View File

@@ -0,0 +1,21 @@
import 'package:anyway/domain/entities/landmark_type.dart';
import 'package:anyway/domain/entities/landmark_description.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'landmark.freezed.dart';
part 'landmark.g.dart';
@unfreezed
abstract class Landmark with _$Landmark {
factory Landmark({
required String uuid,
required String name,
required List<double> location,
required LandmarkType type,
required bool isSecondary,
required LandmarkDescription description,
}) = _Landmark;
factory Landmark.fromJson(Map<String, Object?> json) => _$LandmarkFromJson(json);
}

View File

@@ -0,0 +1,448 @@
// 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 'landmark.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$Landmark {
String get uuid;
set uuid(String value);
String get name;
set name(String value);
List<double> get location;
set location(List<double> value);
LandmarkType get type;
set type(LandmarkType value);
bool get isSecondary;
set isSecondary(bool value);
LandmarkDescription get description;
set description(LandmarkDescription value);
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LandmarkCopyWith<Landmark> get copyWith =>
_$LandmarkCopyWithImpl<Landmark>(this as Landmark, _$identity);
/// Serializes this Landmark to a JSON map.
Map<String, dynamic> toJson();
@override
String toString() {
return 'Landmark(uuid: $uuid, name: $name, location: $location, type: $type, isSecondary: $isSecondary, description: $description)';
}
}
/// @nodoc
abstract mixin class $LandmarkCopyWith<$Res> {
factory $LandmarkCopyWith(Landmark value, $Res Function(Landmark) _then) =
_$LandmarkCopyWithImpl;
@useResult
$Res call(
{String uuid,
String name,
List<double> location,
LandmarkType type,
bool isSecondary,
LandmarkDescription description});
$LandmarkTypeCopyWith<$Res> get type;
$LandmarkDescriptionCopyWith<$Res> get description;
}
/// @nodoc
class _$LandmarkCopyWithImpl<$Res> implements $LandmarkCopyWith<$Res> {
_$LandmarkCopyWithImpl(this._self, this._then);
final Landmark _self;
final $Res Function(Landmark) _then;
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? uuid = null,
Object? name = null,
Object? location = null,
Object? type = null,
Object? isSecondary = null,
Object? description = null,
}) {
return _then(_self.copyWith(
uuid: null == uuid
? _self.uuid
: uuid // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _self.name
: name // ignore: cast_nullable_to_non_nullable
as String,
location: null == location
? _self.location
: location // ignore: cast_nullable_to_non_nullable
as List<double>,
type: null == type
? _self.type
: type // ignore: cast_nullable_to_non_nullable
as LandmarkType,
isSecondary: null == isSecondary
? _self.isSecondary
: isSecondary // ignore: cast_nullable_to_non_nullable
as bool,
description: null == description
? _self.description
: description // ignore: cast_nullable_to_non_nullable
as LandmarkDescription,
));
}
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LandmarkTypeCopyWith<$Res> get type {
return $LandmarkTypeCopyWith<$Res>(_self.type, (value) {
return _then(_self.copyWith(type: value));
});
}
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LandmarkDescriptionCopyWith<$Res> get description {
return $LandmarkDescriptionCopyWith<$Res>(_self.description, (value) {
return _then(_self.copyWith(description: value));
});
}
}
/// Adds pattern-matching-related methods to [Landmark].
extension LandmarkPatterns on Landmark {
/// 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(_Landmark value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Landmark() 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(_Landmark value) $default,
) {
final _that = this;
switch (_that) {
case _Landmark():
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(_Landmark value)? $default,
) {
final _that = this;
switch (_that) {
case _Landmark() 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 uuid,
String name,
List<double> location,
LandmarkType type,
bool isSecondary,
LandmarkDescription description)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Landmark() when $default != null:
return $default(_that.uuid, _that.name, _that.location, _that.type,
_that.isSecondary, _that.description);
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 uuid,
String name,
List<double> location,
LandmarkType type,
bool isSecondary,
LandmarkDescription description)
$default,
) {
final _that = this;
switch (_that) {
case _Landmark():
return $default(_that.uuid, _that.name, _that.location, _that.type,
_that.isSecondary, _that.description);
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 uuid,
String name,
List<double> location,
LandmarkType type,
bool isSecondary,
LandmarkDescription description)?
$default,
) {
final _that = this;
switch (_that) {
case _Landmark() when $default != null:
return $default(_that.uuid, _that.name, _that.location, _that.type,
_that.isSecondary, _that.description);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _Landmark implements Landmark {
_Landmark(
{required this.uuid,
required this.name,
required this.location,
required this.type,
required this.isSecondary,
required this.description});
factory _Landmark.fromJson(Map<String, dynamic> json) =>
_$LandmarkFromJson(json);
@override
String uuid;
@override
String name;
@override
List<double> location;
@override
LandmarkType type;
@override
bool isSecondary;
@override
LandmarkDescription description;
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LandmarkCopyWith<_Landmark> get copyWith =>
__$LandmarkCopyWithImpl<_Landmark>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LandmarkToJson(
this,
);
}
@override
String toString() {
return 'Landmark(uuid: $uuid, name: $name, location: $location, type: $type, isSecondary: $isSecondary, description: $description)';
}
}
/// @nodoc
abstract mixin class _$LandmarkCopyWith<$Res>
implements $LandmarkCopyWith<$Res> {
factory _$LandmarkCopyWith(_Landmark value, $Res Function(_Landmark) _then) =
__$LandmarkCopyWithImpl;
@override
@useResult
$Res call(
{String uuid,
String name,
List<double> location,
LandmarkType type,
bool isSecondary,
LandmarkDescription description});
@override
$LandmarkTypeCopyWith<$Res> get type;
@override
$LandmarkDescriptionCopyWith<$Res> get description;
}
/// @nodoc
class __$LandmarkCopyWithImpl<$Res> implements _$LandmarkCopyWith<$Res> {
__$LandmarkCopyWithImpl(this._self, this._then);
final _Landmark _self;
final $Res Function(_Landmark) _then;
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? uuid = null,
Object? name = null,
Object? location = null,
Object? type = null,
Object? isSecondary = null,
Object? description = null,
}) {
return _then(_Landmark(
uuid: null == uuid
? _self.uuid
: uuid // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _self.name
: name // ignore: cast_nullable_to_non_nullable
as String,
location: null == location
? _self.location
: location // ignore: cast_nullable_to_non_nullable
as List<double>,
type: null == type
? _self.type
: type // ignore: cast_nullable_to_non_nullable
as LandmarkType,
isSecondary: null == isSecondary
? _self.isSecondary
: isSecondary // ignore: cast_nullable_to_non_nullable
as bool,
description: null == description
? _self.description
: description // ignore: cast_nullable_to_non_nullable
as LandmarkDescription,
));
}
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LandmarkTypeCopyWith<$Res> get type {
return $LandmarkTypeCopyWith<$Res>(_self.type, (value) {
return _then(_self.copyWith(type: value));
});
}
/// Create a copy of Landmark
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LandmarkDescriptionCopyWith<$Res> get description {
return $LandmarkDescriptionCopyWith<$Res>(_self.description, (value) {
return _then(_self.copyWith(description: value));
});
}
}
// dart format on

View File

@@ -0,0 +1,28 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'landmark.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_Landmark _$LandmarkFromJson(Map<String, dynamic> json) => _Landmark(
uuid: json['uuid'] as String,
name: json['name'] as String,
location: (json['location'] as List<dynamic>)
.map((e) => (e as num).toDouble())
.toList(),
type: LandmarkType.fromJson(json['type'] as Map<String, dynamic>),
isSecondary: json['isSecondary'] as bool,
description: LandmarkDescription.fromJson(
json['description'] as Map<String, dynamic>),
);
Map<String, dynamic> _$LandmarkToJson(_Landmark instance) => <String, dynamic>{
'uuid': instance.uuid,
'name': instance.name,
'location': instance.location,
'type': instance.type,
'isSecondary': instance.isSecondary,
'description': instance.description,
};

View File

@@ -0,0 +1,15 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'landmark_description.freezed.dart';
part 'landmark_description.g.dart';
@Freezed(makeCollectionsUnmodifiable: false)
abstract class LandmarkDescription with _$LandmarkDescription {
const factory LandmarkDescription({
required String description,
required List<String> tags,
}) = _LandmarkDescription;
factory LandmarkDescription.fromJson(Map<String, Object?> json) => _$LandmarkDescriptionFromJson(json);
}

View File

@@ -0,0 +1,336 @@
// 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 'landmark_description.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LandmarkDescription {
String get description;
List<String> get tags;
/// Create a copy of LandmarkDescription
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LandmarkDescriptionCopyWith<LandmarkDescription> get copyWith =>
_$LandmarkDescriptionCopyWithImpl<LandmarkDescription>(
this as LandmarkDescription, _$identity);
/// Serializes this LandmarkDescription to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is LandmarkDescription &&
(identical(other.description, description) ||
other.description == description) &&
const DeepCollectionEquality().equals(other.tags, tags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, description, const DeepCollectionEquality().hash(tags));
@override
String toString() {
return 'LandmarkDescription(description: $description, tags: $tags)';
}
}
/// @nodoc
abstract mixin class $LandmarkDescriptionCopyWith<$Res> {
factory $LandmarkDescriptionCopyWith(
LandmarkDescription value, $Res Function(LandmarkDescription) _then) =
_$LandmarkDescriptionCopyWithImpl;
@useResult
$Res call({String description, List<String> tags});
}
/// @nodoc
class _$LandmarkDescriptionCopyWithImpl<$Res>
implements $LandmarkDescriptionCopyWith<$Res> {
_$LandmarkDescriptionCopyWithImpl(this._self, this._then);
final LandmarkDescription _self;
final $Res Function(LandmarkDescription) _then;
/// Create a copy of LandmarkDescription
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? description = null,
Object? tags = null,
}) {
return _then(_self.copyWith(
description: null == description
? _self.description
: description // ignore: cast_nullable_to_non_nullable
as String,
tags: null == tags
? _self.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// Adds pattern-matching-related methods to [LandmarkDescription].
extension LandmarkDescriptionPatterns on LandmarkDescription {
/// 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(_LandmarkDescription value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _LandmarkDescription() 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(_LandmarkDescription value) $default,
) {
final _that = this;
switch (_that) {
case _LandmarkDescription():
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(_LandmarkDescription value)? $default,
) {
final _that = this;
switch (_that) {
case _LandmarkDescription() 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 description, List<String> tags)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _LandmarkDescription() when $default != null:
return $default(_that.description, _that.tags);
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 description, List<String> tags) $default,
) {
final _that = this;
switch (_that) {
case _LandmarkDescription():
return $default(_that.description, _that.tags);
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 description, List<String> tags)? $default,
) {
final _that = this;
switch (_that) {
case _LandmarkDescription() when $default != null:
return $default(_that.description, _that.tags);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _LandmarkDescription implements LandmarkDescription {
const _LandmarkDescription({required this.description, required this.tags});
factory _LandmarkDescription.fromJson(Map<String, dynamic> json) =>
_$LandmarkDescriptionFromJson(json);
@override
final String description;
@override
final List<String> tags;
/// Create a copy of LandmarkDescription
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LandmarkDescriptionCopyWith<_LandmarkDescription> get copyWith =>
__$LandmarkDescriptionCopyWithImpl<_LandmarkDescription>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LandmarkDescriptionToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _LandmarkDescription &&
(identical(other.description, description) ||
other.description == description) &&
const DeepCollectionEquality().equals(other.tags, tags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, description, const DeepCollectionEquality().hash(tags));
@override
String toString() {
return 'LandmarkDescription(description: $description, tags: $tags)';
}
}
/// @nodoc
abstract mixin class _$LandmarkDescriptionCopyWith<$Res>
implements $LandmarkDescriptionCopyWith<$Res> {
factory _$LandmarkDescriptionCopyWith(_LandmarkDescription value,
$Res Function(_LandmarkDescription) _then) =
__$LandmarkDescriptionCopyWithImpl;
@override
@useResult
$Res call({String description, List<String> tags});
}
/// @nodoc
class __$LandmarkDescriptionCopyWithImpl<$Res>
implements _$LandmarkDescriptionCopyWith<$Res> {
__$LandmarkDescriptionCopyWithImpl(this._self, this._then);
final _LandmarkDescription _self;
final $Res Function(_LandmarkDescription) _then;
/// Create a copy of LandmarkDescription
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? description = null,
Object? tags = null,
}) {
return _then(_LandmarkDescription(
description: null == description
? _self.description
: description // ignore: cast_nullable_to_non_nullable
as String,
tags: null == tags
? _self.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
// dart format on

View File

@@ -0,0 +1,20 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'landmark_description.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_LandmarkDescription _$LandmarkDescriptionFromJson(Map<String, dynamic> json) =>
_LandmarkDescription(
description: json['description'] as String,
tags: (json['tags'] as List<dynamic>).map((e) => e as String).toList(),
);
Map<String, dynamic> _$LandmarkDescriptionToJson(
_LandmarkDescription instance) =>
<String, dynamic>{
'description': instance.description,
'tags': instance.tags,
};

View File

@@ -0,0 +1,27 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'landmark_type.freezed.dart';
part 'landmark_type.g.dart';
@freezed
abstract class LandmarkType with _$LandmarkType {
const factory LandmarkType({
required LandmarkTypeEnum type,
}) = _LandmarkType;
factory LandmarkType.fromJson(Map<String, Object?> json) => _$LandmarkTypeFromJson(json);
}
@JsonEnum(alwaysCreate: true)
enum LandmarkTypeEnum {
@JsonValue('culture')
culture,
@JsonValue('nature')
nature,
@JsonValue('shopping')
shopping,
}
extension LandmarkTypeEnumExtension on LandmarkTypeEnum {
String get value => _$LandmarkTypeEnumEnumMap[this]!;
}

View File

@@ -0,0 +1,315 @@
// 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 'landmark_type.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LandmarkType {
LandmarkTypeEnum get type;
/// Create a copy of LandmarkType
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LandmarkTypeCopyWith<LandmarkType> get copyWith =>
_$LandmarkTypeCopyWithImpl<LandmarkType>(
this as LandmarkType, _$identity);
/// Serializes this LandmarkType to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is LandmarkType &&
(identical(other.type, type) || other.type == type));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, type);
@override
String toString() {
return 'LandmarkType(type: $type)';
}
}
/// @nodoc
abstract mixin class $LandmarkTypeCopyWith<$Res> {
factory $LandmarkTypeCopyWith(
LandmarkType value, $Res Function(LandmarkType) _then) =
_$LandmarkTypeCopyWithImpl;
@useResult
$Res call({LandmarkTypeEnum type});
}
/// @nodoc
class _$LandmarkTypeCopyWithImpl<$Res> implements $LandmarkTypeCopyWith<$Res> {
_$LandmarkTypeCopyWithImpl(this._self, this._then);
final LandmarkType _self;
final $Res Function(LandmarkType) _then;
/// Create a copy of LandmarkType
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? type = null,
}) {
return _then(_self.copyWith(
type: null == type
? _self.type
: type // ignore: cast_nullable_to_non_nullable
as LandmarkTypeEnum,
));
}
}
/// Adds pattern-matching-related methods to [LandmarkType].
extension LandmarkTypePatterns on LandmarkType {
/// 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(_LandmarkType value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _LandmarkType() 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(_LandmarkType value) $default,
) {
final _that = this;
switch (_that) {
case _LandmarkType():
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(_LandmarkType value)? $default,
) {
final _that = this;
switch (_that) {
case _LandmarkType() 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(LandmarkTypeEnum type)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _LandmarkType() when $default != null:
return $default(_that.type);
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(LandmarkTypeEnum type) $default,
) {
final _that = this;
switch (_that) {
case _LandmarkType():
return $default(_that.type);
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(LandmarkTypeEnum type)? $default,
) {
final _that = this;
switch (_that) {
case _LandmarkType() when $default != null:
return $default(_that.type);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _LandmarkType implements LandmarkType {
const _LandmarkType({required this.type});
factory _LandmarkType.fromJson(Map<String, dynamic> json) =>
_$LandmarkTypeFromJson(json);
@override
final LandmarkTypeEnum type;
/// Create a copy of LandmarkType
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LandmarkTypeCopyWith<_LandmarkType> get copyWith =>
__$LandmarkTypeCopyWithImpl<_LandmarkType>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LandmarkTypeToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _LandmarkType &&
(identical(other.type, type) || other.type == type));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, type);
@override
String toString() {
return 'LandmarkType(type: $type)';
}
}
/// @nodoc
abstract mixin class _$LandmarkTypeCopyWith<$Res>
implements $LandmarkTypeCopyWith<$Res> {
factory _$LandmarkTypeCopyWith(
_LandmarkType value, $Res Function(_LandmarkType) _then) =
__$LandmarkTypeCopyWithImpl;
@override
@useResult
$Res call({LandmarkTypeEnum type});
}
/// @nodoc
class __$LandmarkTypeCopyWithImpl<$Res>
implements _$LandmarkTypeCopyWith<$Res> {
__$LandmarkTypeCopyWithImpl(this._self, this._then);
final _LandmarkType _self;
final $Res Function(_LandmarkType) _then;
/// Create a copy of LandmarkType
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? type = null,
}) {
return _then(_LandmarkType(
type: null == type
? _self.type
: type // ignore: cast_nullable_to_non_nullable
as LandmarkTypeEnum,
));
}
}
// dart format on

View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'landmark_type.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_LandmarkType _$LandmarkTypeFromJson(Map<String, dynamic> json) =>
_LandmarkType(
type: $enumDecode(_$LandmarkTypeEnumEnumMap, json['type']),
);
Map<String, dynamic> _$LandmarkTypeToJson(_LandmarkType instance) =>
<String, dynamic>{
'type': _$LandmarkTypeEnumEnumMap[instance.type]!,
};
const _$LandmarkTypeEnumEnumMap = {
LandmarkTypeEnum.culture: 'culture',
LandmarkTypeEnum.nature: 'nature',
LandmarkTypeEnum.shopping: 'shopping',
};

View File

@@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'preferences.freezed.dart';
part 'preferences.g.dart';
@freezed
abstract class Preferences with _$Preferences {
const factory Preferences({
required String test,
}) = _Preferences;
factory Preferences.fromJson(Map<String, Object?> json) => _$PreferencesFromJson(json);
}

View File

@@ -0,0 +1,313 @@
// 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 'preferences.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$Preferences {
String get test;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PreferencesCopyWith<Preferences> get copyWith =>
_$PreferencesCopyWithImpl<Preferences>(this as Preferences, _$identity);
/// Serializes this Preferences to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Preferences &&
(identical(other.test, test) || other.test == test));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, test);
@override
String toString() {
return 'Preferences(test: $test)';
}
}
/// @nodoc
abstract mixin class $PreferencesCopyWith<$Res> {
factory $PreferencesCopyWith(
Preferences value, $Res Function(Preferences) _then) =
_$PreferencesCopyWithImpl;
@useResult
$Res call({String test});
}
/// @nodoc
class _$PreferencesCopyWithImpl<$Res> implements $PreferencesCopyWith<$Res> {
_$PreferencesCopyWithImpl(this._self, this._then);
final Preferences _self;
final $Res Function(Preferences) _then;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? test = null,
}) {
return _then(_self.copyWith(
test: null == test
? _self.test
: test // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [Preferences].
extension PreferencesPatterns on Preferences {
/// 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(_Preferences value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Preferences() 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(_Preferences value) $default,
) {
final _that = this;
switch (_that) {
case _Preferences():
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(_Preferences value)? $default,
) {
final _that = this;
switch (_that) {
case _Preferences() 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 test)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Preferences() when $default != null:
return $default(_that.test);
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 test) $default,
) {
final _that = this;
switch (_that) {
case _Preferences():
return $default(_that.test);
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 test)? $default,
) {
final _that = this;
switch (_that) {
case _Preferences() when $default != null:
return $default(_that.test);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _Preferences implements Preferences {
const _Preferences({required this.test});
factory _Preferences.fromJson(Map<String, dynamic> json) =>
_$PreferencesFromJson(json);
@override
final String test;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$PreferencesCopyWith<_Preferences> get copyWith =>
__$PreferencesCopyWithImpl<_Preferences>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$PreferencesToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _Preferences &&
(identical(other.test, test) || other.test == test));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, test);
@override
String toString() {
return 'Preferences(test: $test)';
}
}
/// @nodoc
abstract mixin class _$PreferencesCopyWith<$Res>
implements $PreferencesCopyWith<$Res> {
factory _$PreferencesCopyWith(
_Preferences value, $Res Function(_Preferences) _then) =
__$PreferencesCopyWithImpl;
@override
@useResult
$Res call({String test});
}
/// @nodoc
class __$PreferencesCopyWithImpl<$Res> implements _$PreferencesCopyWith<$Res> {
__$PreferencesCopyWithImpl(this._self, this._then);
final _Preferences _self;
final $Res Function(_Preferences) _then;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? test = null,
}) {
return _then(_Preferences(
test: null == test
? _self.test
: test // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,16 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'preferences.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_Preferences _$PreferencesFromJson(Map<String, dynamic> json) => _Preferences(
test: json['test'] as String,
);
Map<String, dynamic> _$PreferencesToJson(_Preferences instance) =>
<String, dynamic>{
'test': instance.test,
};

View File

@@ -0,0 +1,19 @@
import 'package:anyway/domain/entities/landmark.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'trip.freezed.dart';
part 'trip.g.dart';
@Freezed(makeCollectionsUnmodifiable: false)
abstract class Trip with _$Trip {
const factory Trip({
required String uuid,
// Duration totalTime,
required List<Landmark> landmarks,
}) = _Trip;
factory Trip.fromJson(Map<String, Object?> json) => _$TripFromJson(json);
}

View File

@@ -0,0 +1,327 @@
// 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 'trip.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$Trip {
String get uuid; // Duration totalTime,
List<Landmark> get landmarks;
/// Create a copy of Trip
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$TripCopyWith<Trip> get copyWith =>
_$TripCopyWithImpl<Trip>(this as Trip, _$identity);
/// Serializes this Trip to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Trip &&
(identical(other.uuid, uuid) || other.uuid == uuid) &&
const DeepCollectionEquality().equals(other.landmarks, landmarks));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, uuid, const DeepCollectionEquality().hash(landmarks));
@override
String toString() {
return 'Trip(uuid: $uuid, landmarks: $landmarks)';
}
}
/// @nodoc
abstract mixin class $TripCopyWith<$Res> {
factory $TripCopyWith(Trip value, $Res Function(Trip) _then) =
_$TripCopyWithImpl;
@useResult
$Res call({String uuid, List<Landmark> landmarks});
}
/// @nodoc
class _$TripCopyWithImpl<$Res> implements $TripCopyWith<$Res> {
_$TripCopyWithImpl(this._self, this._then);
final Trip _self;
final $Res Function(Trip) _then;
/// Create a copy of Trip
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? uuid = null,
Object? landmarks = null,
}) {
return _then(_self.copyWith(
uuid: null == uuid
? _self.uuid
: uuid // ignore: cast_nullable_to_non_nullable
as String,
landmarks: null == landmarks
? _self.landmarks
: landmarks // ignore: cast_nullable_to_non_nullable
as List<Landmark>,
));
}
}
/// Adds pattern-matching-related methods to [Trip].
extension TripPatterns on Trip {
/// 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(_Trip value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Trip() 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(_Trip value) $default,
) {
final _that = this;
switch (_that) {
case _Trip():
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(_Trip value)? $default,
) {
final _that = this;
switch (_that) {
case _Trip() 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 uuid, List<Landmark> landmarks)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Trip() when $default != null:
return $default(_that.uuid, _that.landmarks);
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 uuid, List<Landmark> landmarks) $default,
) {
final _that = this;
switch (_that) {
case _Trip():
return $default(_that.uuid, _that.landmarks);
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 uuid, List<Landmark> landmarks)? $default,
) {
final _that = this;
switch (_that) {
case _Trip() when $default != null:
return $default(_that.uuid, _that.landmarks);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _Trip implements Trip {
const _Trip({required this.uuid, required this.landmarks});
factory _Trip.fromJson(Map<String, dynamic> json) => _$TripFromJson(json);
@override
final String uuid;
// Duration totalTime,
@override
final List<Landmark> landmarks;
/// Create a copy of Trip
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$TripCopyWith<_Trip> get copyWith =>
__$TripCopyWithImpl<_Trip>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$TripToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _Trip &&
(identical(other.uuid, uuid) || other.uuid == uuid) &&
const DeepCollectionEquality().equals(other.landmarks, landmarks));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, uuid, const DeepCollectionEquality().hash(landmarks));
@override
String toString() {
return 'Trip(uuid: $uuid, landmarks: $landmarks)';
}
}
/// @nodoc
abstract mixin class _$TripCopyWith<$Res> implements $TripCopyWith<$Res> {
factory _$TripCopyWith(_Trip value, $Res Function(_Trip) _then) =
__$TripCopyWithImpl;
@override
@useResult
$Res call({String uuid, List<Landmark> landmarks});
}
/// @nodoc
class __$TripCopyWithImpl<$Res> implements _$TripCopyWith<$Res> {
__$TripCopyWithImpl(this._self, this._then);
final _Trip _self;
final $Res Function(_Trip) _then;
/// Create a copy of Trip
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? uuid = null,
Object? landmarks = null,
}) {
return _then(_Trip(
uuid: null == uuid
? _self.uuid
: uuid // ignore: cast_nullable_to_non_nullable
as String,
landmarks: null == landmarks
? _self.landmarks
: landmarks // ignore: cast_nullable_to_non_nullable
as List<Landmark>,
));
}
}
// dart format on

View File

@@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'trip.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_Trip _$TripFromJson(Map<String, dynamic> json) => _Trip(
uuid: json['uuid'] as String,
landmarks: (json['landmarks'] as List<dynamic>)
.map((e) => Landmark.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$TripToJson(_Trip instance) => <String, dynamic>{
'uuid': instance.uuid,
'landmarks': instance.landmarks,
};

View File

@@ -0,0 +1,5 @@
import 'package:anyway/domain/entities/preferences.dart';
abstract class PreferencesRepository {
Future<Preferences> getPreferences();
}

View File

@@ -0,0 +1,6 @@
import 'package:anyway/domain/entities/preferences.dart';
import 'package:anyway/domain/entities/trip.dart';
abstract class TripRepository {
Future<Trip> getTrip({Preferences? preferences, String? tripUUID});
}