mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Flutter 3.29 beta (#2571)
This commit is contained in:
@@ -16,13 +16,10 @@ import 'model/user/user_api_model.dart';
|
||||
typedef AuthHeaderProvider = String? Function();
|
||||
|
||||
class ApiClient {
|
||||
ApiClient({
|
||||
String? host,
|
||||
int? port,
|
||||
HttpClient Function()? clientFactory,
|
||||
}) : _host = host ?? 'localhost',
|
||||
_port = port ?? 8080,
|
||||
_clientFactory = clientFactory ?? HttpClient.new;
|
||||
ApiClient({String? host, int? port, HttpClient Function()? clientFactory})
|
||||
: _host = host ?? 'localhost',
|
||||
_port = port ?? 8080,
|
||||
_clientFactory = clientFactory ?? HttpClient.new;
|
||||
|
||||
final String _host;
|
||||
final int _port;
|
||||
@@ -51,7 +48,8 @@ class ApiClient {
|
||||
final stringData = await response.transform(utf8.decoder).join();
|
||||
final json = jsonDecode(stringData) as List<dynamic>;
|
||||
return Result.ok(
|
||||
json.map((element) => Continent.fromJson(element)).toList());
|
||||
json.map((element) => Continent.fromJson(element)).toList(),
|
||||
);
|
||||
} else {
|
||||
return const Result.error(HttpException("Invalid response"));
|
||||
}
|
||||
@@ -72,7 +70,8 @@ class ApiClient {
|
||||
final stringData = await response.transform(utf8.decoder).join();
|
||||
final json = jsonDecode(stringData) as List<dynamic>;
|
||||
return Result.ok(
|
||||
json.map((element) => Destination.fromJson(element)).toList());
|
||||
json.map((element) => Destination.fromJson(element)).toList(),
|
||||
);
|
||||
} else {
|
||||
return const Result.error(HttpException("Invalid response"));
|
||||
}
|
||||
@@ -86,8 +85,11 @@ class ApiClient {
|
||||
Future<Result<List<Activity>>> getActivityByDestination(String ref) async {
|
||||
final client = _clientFactory();
|
||||
try {
|
||||
final request =
|
||||
await client.get(_host, _port, '/destination/$ref/activity');
|
||||
final request = await client.get(
|
||||
_host,
|
||||
_port,
|
||||
'/destination/$ref/activity',
|
||||
);
|
||||
await _authHeader(request.headers);
|
||||
final response = await request.close();
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
@@ -10,13 +10,10 @@ import 'model/login_request/login_request.dart';
|
||||
import 'model/login_response/login_response.dart';
|
||||
|
||||
class AuthApiClient {
|
||||
AuthApiClient({
|
||||
String? host,
|
||||
int? port,
|
||||
HttpClient Function()? clientFactory,
|
||||
}) : _host = host ?? 'localhost',
|
||||
_port = port ?? 8080,
|
||||
_clientFactory = clientFactory ?? HttpClient.new;
|
||||
AuthApiClient({String? host, int? port, HttpClient Function()? clientFactory})
|
||||
: _host = host ?? 'localhost',
|
||||
_port = port ?? 8080,
|
||||
_clientFactory = clientFactory ?? HttpClient.new;
|
||||
|
||||
final String _host;
|
||||
final int _port;
|
||||
|
||||
@@ -12,7 +12,8 @@ part of 'booking_api_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
BookingApiModel _$BookingApiModelFromJson(Map<String, dynamic> json) {
|
||||
return _BookingApiModel.fromJson(json);
|
||||
@@ -52,16 +53,18 @@ mixin _$BookingApiModel {
|
||||
/// @nodoc
|
||||
abstract class $BookingApiModelCopyWith<$Res> {
|
||||
factory $BookingApiModelCopyWith(
|
||||
BookingApiModel value, $Res Function(BookingApiModel) then) =
|
||||
_$BookingApiModelCopyWithImpl<$Res, BookingApiModel>;
|
||||
BookingApiModel value,
|
||||
$Res Function(BookingApiModel) then,
|
||||
) = _$BookingApiModelCopyWithImpl<$Res, BookingApiModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int? id,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
String name,
|
||||
String destinationRef,
|
||||
List<String> activitiesRef});
|
||||
$Res call({
|
||||
int? id,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
String name,
|
||||
String destinationRef,
|
||||
List<String> activitiesRef,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -86,50 +89,61 @@ class _$BookingApiModelCopyWithImpl<$Res, $Val extends BookingApiModel>
|
||||
Object? destinationRef = null,
|
||||
Object? activitiesRef = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
startDate: null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
endDate: null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
destinationRef: null == destinationRef
|
||||
? _value.destinationRef
|
||||
: destinationRef // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
activitiesRef: null == activitiesRef
|
||||
? _value.activitiesRef
|
||||
: activitiesRef // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
) as $Val);
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id:
|
||||
freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
startDate:
|
||||
null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
endDate:
|
||||
null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
name:
|
||||
null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
destinationRef:
|
||||
null == destinationRef
|
||||
? _value.destinationRef
|
||||
: destinationRef // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
activitiesRef:
|
||||
null == activitiesRef
|
||||
? _value.activitiesRef
|
||||
: activitiesRef // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$BookingApiModelImplCopyWith<$Res>
|
||||
implements $BookingApiModelCopyWith<$Res> {
|
||||
factory _$$BookingApiModelImplCopyWith(_$BookingApiModelImpl value,
|
||||
$Res Function(_$BookingApiModelImpl) then) =
|
||||
__$$BookingApiModelImplCopyWithImpl<$Res>;
|
||||
factory _$$BookingApiModelImplCopyWith(
|
||||
_$BookingApiModelImpl value,
|
||||
$Res Function(_$BookingApiModelImpl) then,
|
||||
) = __$$BookingApiModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int? id,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
String name,
|
||||
String destinationRef,
|
||||
List<String> activitiesRef});
|
||||
$Res call({
|
||||
int? id,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
String name,
|
||||
String destinationRef,
|
||||
List<String> activitiesRef,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -137,8 +151,9 @@ class __$$BookingApiModelImplCopyWithImpl<$Res>
|
||||
extends _$BookingApiModelCopyWithImpl<$Res, _$BookingApiModelImpl>
|
||||
implements _$$BookingApiModelImplCopyWith<$Res> {
|
||||
__$$BookingApiModelImplCopyWithImpl(
|
||||
_$BookingApiModelImpl _value, $Res Function(_$BookingApiModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$BookingApiModelImpl _value,
|
||||
$Res Function(_$BookingApiModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of BookingApiModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -152,46 +167,54 @@ class __$$BookingApiModelImplCopyWithImpl<$Res>
|
||||
Object? destinationRef = null,
|
||||
Object? activitiesRef = null,
|
||||
}) {
|
||||
return _then(_$BookingApiModelImpl(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
startDate: null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
endDate: null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
destinationRef: null == destinationRef
|
||||
? _value.destinationRef
|
||||
: destinationRef // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
activitiesRef: null == activitiesRef
|
||||
? _value._activitiesRef
|
||||
: activitiesRef // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
return _then(
|
||||
_$BookingApiModelImpl(
|
||||
id:
|
||||
freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
startDate:
|
||||
null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
endDate:
|
||||
null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
name:
|
||||
null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
destinationRef:
|
||||
null == destinationRef
|
||||
? _value.destinationRef
|
||||
: destinationRef // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
activitiesRef:
|
||||
null == activitiesRef
|
||||
? _value._activitiesRef
|
||||
: activitiesRef // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$BookingApiModelImpl implements _BookingApiModel {
|
||||
const _$BookingApiModelImpl(
|
||||
{this.id,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
required this.name,
|
||||
required this.destinationRef,
|
||||
required final List<String> activitiesRef})
|
||||
: _activitiesRef = activitiesRef;
|
||||
const _$BookingApiModelImpl({
|
||||
this.id,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
required this.name,
|
||||
required this.destinationRef,
|
||||
required final List<String> activitiesRef,
|
||||
}) : _activitiesRef = activitiesRef;
|
||||
|
||||
factory _$BookingApiModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$BookingApiModelImplFromJson(json);
|
||||
@@ -245,14 +268,23 @@ class _$BookingApiModelImpl implements _BookingApiModel {
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.destinationRef, destinationRef) ||
|
||||
other.destinationRef == destinationRef) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._activitiesRef, _activitiesRef));
|
||||
const DeepCollectionEquality().equals(
|
||||
other._activitiesRef,
|
||||
_activitiesRef,
|
||||
));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, startDate, endDate, name,
|
||||
destinationRef, const DeepCollectionEquality().hash(_activitiesRef));
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
startDate,
|
||||
endDate,
|
||||
name,
|
||||
destinationRef,
|
||||
const DeepCollectionEquality().hash(_activitiesRef),
|
||||
);
|
||||
|
||||
/// Create a copy of BookingApiModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -261,24 +293,25 @@ class _$BookingApiModelImpl implements _BookingApiModel {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$BookingApiModelImplCopyWith<_$BookingApiModelImpl> get copyWith =>
|
||||
__$$BookingApiModelImplCopyWithImpl<_$BookingApiModelImpl>(
|
||||
this, _$identity);
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$BookingApiModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$BookingApiModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _BookingApiModel implements BookingApiModel {
|
||||
const factory _BookingApiModel(
|
||||
{final int? id,
|
||||
required final DateTime startDate,
|
||||
required final DateTime endDate,
|
||||
required final String name,
|
||||
required final String destinationRef,
|
||||
required final List<String> activitiesRef}) = _$BookingApiModelImpl;
|
||||
const factory _BookingApiModel({
|
||||
final int? id,
|
||||
required final DateTime startDate,
|
||||
required final DateTime endDate,
|
||||
required final String name,
|
||||
required final String destinationRef,
|
||||
required final List<String> activitiesRef,
|
||||
}) = _$BookingApiModelImpl;
|
||||
|
||||
factory _BookingApiModel.fromJson(Map<String, dynamic> json) =
|
||||
_$BookingApiModelImpl.fromJson;
|
||||
|
||||
@@ -7,25 +7,24 @@ part of 'booking_api_model.dart';
|
||||
// **************************************************************************
|
||||
|
||||
_$BookingApiModelImpl _$$BookingApiModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$BookingApiModelImpl(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
startDate: DateTime.parse(json['startDate'] as String),
|
||||
endDate: DateTime.parse(json['endDate'] as String),
|
||||
name: json['name'] as String,
|
||||
destinationRef: json['destinationRef'] as String,
|
||||
activitiesRef: (json['activitiesRef'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
Map<String, dynamic> json,
|
||||
) => _$BookingApiModelImpl(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
startDate: DateTime.parse(json['startDate'] as String),
|
||||
endDate: DateTime.parse(json['endDate'] as String),
|
||||
name: json['name'] as String,
|
||||
destinationRef: json['destinationRef'] as String,
|
||||
activitiesRef:
|
||||
(json['activitiesRef'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$BookingApiModelImplToJson(
|
||||
_$BookingApiModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'startDate': instance.startDate.toIso8601String(),
|
||||
'endDate': instance.endDate.toIso8601String(),
|
||||
'name': instance.name,
|
||||
'destinationRef': instance.destinationRef,
|
||||
'activitiesRef': instance.activitiesRef,
|
||||
};
|
||||
_$BookingApiModelImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'startDate': instance.startDate.toIso8601String(),
|
||||
'endDate': instance.endDate.toIso8601String(),
|
||||
'name': instance.name,
|
||||
'destinationRef': instance.destinationRef,
|
||||
'activitiesRef': instance.activitiesRef,
|
||||
};
|
||||
|
||||
@@ -12,7 +12,8 @@ part of 'login_request.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
LoginRequest _$LoginRequestFromJson(Map<String, dynamic> json) {
|
||||
return _LoginRequest.fromJson(json);
|
||||
@@ -39,8 +40,9 @@ mixin _$LoginRequest {
|
||||
/// @nodoc
|
||||
abstract class $LoginRequestCopyWith<$Res> {
|
||||
factory $LoginRequestCopyWith(
|
||||
LoginRequest value, $Res Function(LoginRequest) then) =
|
||||
_$LoginRequestCopyWithImpl<$Res, LoginRequest>;
|
||||
LoginRequest value,
|
||||
$Res Function(LoginRequest) then,
|
||||
) = _$LoginRequestCopyWithImpl<$Res, LoginRequest>;
|
||||
@useResult
|
||||
$Res call({String email, String password});
|
||||
}
|
||||
@@ -59,20 +61,22 @@ class _$LoginRequestCopyWithImpl<$Res, $Val extends LoginRequest>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? email = null,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
$Res call({Object? email = null, Object? password = null}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
email:
|
||||
null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password:
|
||||
null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +84,9 @@ class _$LoginRequestCopyWithImpl<$Res, $Val extends LoginRequest>
|
||||
abstract class _$$LoginRequestImplCopyWith<$Res>
|
||||
implements $LoginRequestCopyWith<$Res> {
|
||||
factory _$$LoginRequestImplCopyWith(
|
||||
_$LoginRequestImpl value, $Res Function(_$LoginRequestImpl) then) =
|
||||
__$$LoginRequestImplCopyWithImpl<$Res>;
|
||||
_$LoginRequestImpl value,
|
||||
$Res Function(_$LoginRequestImpl) then,
|
||||
) = __$$LoginRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String email, String password});
|
||||
@@ -92,27 +97,29 @@ class __$$LoginRequestImplCopyWithImpl<$Res>
|
||||
extends _$LoginRequestCopyWithImpl<$Res, _$LoginRequestImpl>
|
||||
implements _$$LoginRequestImplCopyWith<$Res> {
|
||||
__$$LoginRequestImplCopyWithImpl(
|
||||
_$LoginRequestImpl _value, $Res Function(_$LoginRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$LoginRequestImpl _value,
|
||||
$Res Function(_$LoginRequestImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? email = null,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_$LoginRequestImpl(
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
$Res call({Object? email = null, Object? password = null}) {
|
||||
return _then(
|
||||
_$LoginRequestImpl(
|
||||
email:
|
||||
null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password:
|
||||
null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,16 +168,15 @@ class _$LoginRequestImpl implements _LoginRequest {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$LoginRequestImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginRequest implements LoginRequest {
|
||||
const factory _LoginRequest(
|
||||
{required final String email,
|
||||
required final String password}) = _$LoginRequestImpl;
|
||||
const factory _LoginRequest({
|
||||
required final String email,
|
||||
required final String password,
|
||||
}) = _$LoginRequestImpl;
|
||||
|
||||
factory _LoginRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginRequestImpl.fromJson;
|
||||
|
||||
@@ -13,7 +13,4 @@ _$LoginRequestImpl _$$LoginRequestImplFromJson(Map<String, dynamic> json) =>
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginRequestImplToJson(_$LoginRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'email': instance.email,
|
||||
'password': instance.password,
|
||||
};
|
||||
<String, dynamic>{'email': instance.email, 'password': instance.password};
|
||||
|
||||
@@ -12,7 +12,8 @@ part of 'login_response.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
LoginResponse _$LoginResponseFromJson(Map<String, dynamic> json) {
|
||||
return _LoginResponse.fromJson(json);
|
||||
@@ -39,8 +40,9 @@ mixin _$LoginResponse {
|
||||
/// @nodoc
|
||||
abstract class $LoginResponseCopyWith<$Res> {
|
||||
factory $LoginResponseCopyWith(
|
||||
LoginResponse value, $Res Function(LoginResponse) then) =
|
||||
_$LoginResponseCopyWithImpl<$Res, LoginResponse>;
|
||||
LoginResponse value,
|
||||
$Res Function(LoginResponse) then,
|
||||
) = _$LoginResponseCopyWithImpl<$Res, LoginResponse>;
|
||||
@useResult
|
||||
$Res call({String token, String userId});
|
||||
}
|
||||
@@ -59,20 +61,22 @@ class _$LoginResponseCopyWithImpl<$Res, $Val extends LoginResponse>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? token = null,
|
||||
Object? userId = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
token: null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
$Res call({Object? token = null, Object? userId = null}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
token:
|
||||
null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
userId:
|
||||
null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +84,9 @@ class _$LoginResponseCopyWithImpl<$Res, $Val extends LoginResponse>
|
||||
abstract class _$$LoginResponseImplCopyWith<$Res>
|
||||
implements $LoginResponseCopyWith<$Res> {
|
||||
factory _$$LoginResponseImplCopyWith(
|
||||
_$LoginResponseImpl value, $Res Function(_$LoginResponseImpl) then) =
|
||||
__$$LoginResponseImplCopyWithImpl<$Res>;
|
||||
_$LoginResponseImpl value,
|
||||
$Res Function(_$LoginResponseImpl) then,
|
||||
) = __$$LoginResponseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String token, String userId});
|
||||
@@ -92,27 +97,29 @@ class __$$LoginResponseImplCopyWithImpl<$Res>
|
||||
extends _$LoginResponseCopyWithImpl<$Res, _$LoginResponseImpl>
|
||||
implements _$$LoginResponseImplCopyWith<$Res> {
|
||||
__$$LoginResponseImplCopyWithImpl(
|
||||
_$LoginResponseImpl _value, $Res Function(_$LoginResponseImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$LoginResponseImpl _value,
|
||||
$Res Function(_$LoginResponseImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? token = null,
|
||||
Object? userId = null,
|
||||
}) {
|
||||
return _then(_$LoginResponseImpl(
|
||||
token: null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
$Res call({Object? token = null, Object? userId = null}) {
|
||||
return _then(
|
||||
_$LoginResponseImpl(
|
||||
token:
|
||||
null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
userId:
|
||||
null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,16 +167,15 @@ class _$LoginResponseImpl implements _LoginResponse {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginResponseImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$LoginResponseImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginResponse implements LoginResponse {
|
||||
const factory _LoginResponse(
|
||||
{required final String token,
|
||||
required final String userId}) = _$LoginResponseImpl;
|
||||
const factory _LoginResponse({
|
||||
required final String token,
|
||||
required final String userId,
|
||||
}) = _$LoginResponseImpl;
|
||||
|
||||
factory _LoginResponse.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginResponseImpl.fromJson;
|
||||
|
||||
@@ -13,7 +13,4 @@ _$LoginResponseImpl _$$LoginResponseImplFromJson(Map<String, dynamic> json) =>
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginResponseImplToJson(_$LoginResponseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'token': instance.token,
|
||||
'userId': instance.userId,
|
||||
};
|
||||
<String, dynamic>{'token': instance.token, 'userId': instance.userId};
|
||||
|
||||
@@ -12,7 +12,8 @@ part of 'user_api_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
UserApiModel _$UserApiModelFromJson(Map<String, dynamic> json) {
|
||||
return _UserApiModel.fromJson(json);
|
||||
@@ -45,8 +46,9 @@ mixin _$UserApiModel {
|
||||
/// @nodoc
|
||||
abstract class $UserApiModelCopyWith<$Res> {
|
||||
factory $UserApiModelCopyWith(
|
||||
UserApiModel value, $Res Function(UserApiModel) then) =
|
||||
_$UserApiModelCopyWithImpl<$Res, UserApiModel>;
|
||||
UserApiModel value,
|
||||
$Res Function(UserApiModel) then,
|
||||
) = _$UserApiModelCopyWithImpl<$Res, UserApiModel>;
|
||||
@useResult
|
||||
$Res call({String id, String name, String email, String picture});
|
||||
}
|
||||
@@ -71,24 +73,31 @@ class _$UserApiModelCopyWithImpl<$Res, $Val extends UserApiModel>
|
||||
Object? email = null,
|
||||
Object? picture = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
picture: null == picture
|
||||
? _value.picture
|
||||
: picture // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id:
|
||||
null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name:
|
||||
null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email:
|
||||
null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
picture:
|
||||
null == picture
|
||||
? _value.picture
|
||||
: picture // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,8 +105,9 @@ class _$UserApiModelCopyWithImpl<$Res, $Val extends UserApiModel>
|
||||
abstract class _$$UserApiModelImplCopyWith<$Res>
|
||||
implements $UserApiModelCopyWith<$Res> {
|
||||
factory _$$UserApiModelImplCopyWith(
|
||||
_$UserApiModelImpl value, $Res Function(_$UserApiModelImpl) then) =
|
||||
__$$UserApiModelImplCopyWithImpl<$Res>;
|
||||
_$UserApiModelImpl value,
|
||||
$Res Function(_$UserApiModelImpl) then,
|
||||
) = __$$UserApiModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String id, String name, String email, String picture});
|
||||
@@ -108,8 +118,9 @@ class __$$UserApiModelImplCopyWithImpl<$Res>
|
||||
extends _$UserApiModelCopyWithImpl<$Res, _$UserApiModelImpl>
|
||||
implements _$$UserApiModelImplCopyWith<$Res> {
|
||||
__$$UserApiModelImplCopyWithImpl(
|
||||
_$UserApiModelImpl _value, $Res Function(_$UserApiModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$UserApiModelImpl _value,
|
||||
$Res Function(_$UserApiModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserApiModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -121,35 +132,42 @@ class __$$UserApiModelImplCopyWithImpl<$Res>
|
||||
Object? email = null,
|
||||
Object? picture = null,
|
||||
}) {
|
||||
return _then(_$UserApiModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
picture: null == picture
|
||||
? _value.picture
|
||||
: picture // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
return _then(
|
||||
_$UserApiModelImpl(
|
||||
id:
|
||||
null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name:
|
||||
null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email:
|
||||
null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
picture:
|
||||
null == picture
|
||||
? _value.picture
|
||||
: picture // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$UserApiModelImpl implements _UserApiModel {
|
||||
const _$UserApiModelImpl(
|
||||
{required this.id,
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.picture});
|
||||
const _$UserApiModelImpl({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.picture,
|
||||
});
|
||||
|
||||
factory _$UserApiModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$UserApiModelImplFromJson(json);
|
||||
@@ -200,18 +218,17 @@ class _$UserApiModelImpl implements _UserApiModel {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$UserApiModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$UserApiModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UserApiModel implements UserApiModel {
|
||||
const factory _UserApiModel(
|
||||
{required final String id,
|
||||
required final String name,
|
||||
required final String email,
|
||||
required final String picture}) = _$UserApiModelImpl;
|
||||
const factory _UserApiModel({
|
||||
required final String id,
|
||||
required final String name,
|
||||
required final String email,
|
||||
required final String picture,
|
||||
}) = _$UserApiModelImpl;
|
||||
|
||||
factory _UserApiModel.fromJson(Map<String, dynamic> json) =
|
||||
_$UserApiModelImpl.fromJson;
|
||||
|
||||
Reference in New Issue
Block a user