forked from eatvio/eatvio_app
fix: remove ignored files
This commit is contained in:
@@ -1,292 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'create_plan_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
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');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreatePlanModel {
|
||||
String? get name => throw _privateConstructorUsedError;
|
||||
String? get details => throw _privateConstructorUsedError;
|
||||
String? get state => throw _privateConstructorUsedError;
|
||||
int? get duration => throw _privateConstructorUsedError;
|
||||
List<bool> get type => throw _privateConstructorUsedError;
|
||||
XFile? get image => throw _privateConstructorUsedError;
|
||||
List<PacketOptions> get options => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CreatePlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CreatePlanModelCopyWith<CreatePlanModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CreatePlanModelCopyWith<$Res> {
|
||||
factory $CreatePlanModelCopyWith(
|
||||
CreatePlanModel value, $Res Function(CreatePlanModel) then) =
|
||||
_$CreatePlanModelCopyWithImpl<$Res, CreatePlanModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String? name,
|
||||
String? details,
|
||||
String? state,
|
||||
int? duration,
|
||||
List<bool> type,
|
||||
XFile? image,
|
||||
List<PacketOptions> options});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CreatePlanModelCopyWithImpl<$Res, $Val extends CreatePlanModel>
|
||||
implements $CreatePlanModelCopyWith<$Res> {
|
||||
_$CreatePlanModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CreatePlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = freezed,
|
||||
Object? details = freezed,
|
||||
Object? state = freezed,
|
||||
Object? duration = freezed,
|
||||
Object? type = null,
|
||||
Object? image = freezed,
|
||||
Object? options = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
details: freezed == details
|
||||
? _value.details
|
||||
: details // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
state: freezed == state
|
||||
? _value.state
|
||||
: state // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
duration: freezed == duration
|
||||
? _value.duration
|
||||
: duration // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as List<bool>,
|
||||
image: freezed == image
|
||||
? _value.image
|
||||
: image // ignore: cast_nullable_to_non_nullable
|
||||
as XFile?,
|
||||
options: null == options
|
||||
? _value.options
|
||||
: options // ignore: cast_nullable_to_non_nullable
|
||||
as List<PacketOptions>,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CreatePlanModelImplCopyWith<$Res>
|
||||
implements $CreatePlanModelCopyWith<$Res> {
|
||||
factory _$$CreatePlanModelImplCopyWith(_$CreatePlanModelImpl value,
|
||||
$Res Function(_$CreatePlanModelImpl) then) =
|
||||
__$$CreatePlanModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String? name,
|
||||
String? details,
|
||||
String? state,
|
||||
int? duration,
|
||||
List<bool> type,
|
||||
XFile? image,
|
||||
List<PacketOptions> options});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CreatePlanModelImplCopyWithImpl<$Res>
|
||||
extends _$CreatePlanModelCopyWithImpl<$Res, _$CreatePlanModelImpl>
|
||||
implements _$$CreatePlanModelImplCopyWith<$Res> {
|
||||
__$$CreatePlanModelImplCopyWithImpl(
|
||||
_$CreatePlanModelImpl _value, $Res Function(_$CreatePlanModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CreatePlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = freezed,
|
||||
Object? details = freezed,
|
||||
Object? state = freezed,
|
||||
Object? duration = freezed,
|
||||
Object? type = null,
|
||||
Object? image = freezed,
|
||||
Object? options = null,
|
||||
}) {
|
||||
return _then(_$CreatePlanModelImpl(
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
details: freezed == details
|
||||
? _value.details
|
||||
: details // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
state: freezed == state
|
||||
? _value.state
|
||||
: state // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
duration: freezed == duration
|
||||
? _value.duration
|
||||
: duration // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
type: null == type
|
||||
? _value._type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as List<bool>,
|
||||
image: freezed == image
|
||||
? _value.image
|
||||
: image // ignore: cast_nullable_to_non_nullable
|
||||
as XFile?,
|
||||
options: null == options
|
||||
? _value._options
|
||||
: options // ignore: cast_nullable_to_non_nullable
|
||||
as List<PacketOptions>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CreatePlanModelImpl extends _CreatePlanModel {
|
||||
const _$CreatePlanModelImpl(
|
||||
{this.name,
|
||||
this.details,
|
||||
this.state,
|
||||
this.duration,
|
||||
required final List<bool> type,
|
||||
this.image,
|
||||
required final List<PacketOptions> options})
|
||||
: _type = type,
|
||||
_options = options,
|
||||
super._();
|
||||
|
||||
@override
|
||||
final String? name;
|
||||
@override
|
||||
final String? details;
|
||||
@override
|
||||
final String? state;
|
||||
@override
|
||||
final int? duration;
|
||||
final List<bool> _type;
|
||||
@override
|
||||
List<bool> get type {
|
||||
if (_type is EqualUnmodifiableListView) return _type;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_type);
|
||||
}
|
||||
|
||||
@override
|
||||
final XFile? image;
|
||||
final List<PacketOptions> _options;
|
||||
@override
|
||||
List<PacketOptions> get options {
|
||||
if (_options is EqualUnmodifiableListView) return _options;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreatePlanModel(name: $name, details: $details, state: $state, duration: $duration, type: $type, image: $image, options: $options)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CreatePlanModelImpl &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.details, details) || other.details == details) &&
|
||||
(identical(other.state, state) || other.state == state) &&
|
||||
(identical(other.duration, duration) ||
|
||||
other.duration == duration) &&
|
||||
const DeepCollectionEquality().equals(other._type, _type) &&
|
||||
(identical(other.image, image) || other.image == image) &&
|
||||
const DeepCollectionEquality().equals(other._options, _options));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
name,
|
||||
details,
|
||||
state,
|
||||
duration,
|
||||
const DeepCollectionEquality().hash(_type),
|
||||
image,
|
||||
const DeepCollectionEquality().hash(_options));
|
||||
|
||||
/// Create a copy of CreatePlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CreatePlanModelImplCopyWith<_$CreatePlanModelImpl> get copyWith =>
|
||||
__$$CreatePlanModelImplCopyWithImpl<_$CreatePlanModelImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CreatePlanModel extends CreatePlanModel {
|
||||
const factory _CreatePlanModel(
|
||||
{final String? name,
|
||||
final String? details,
|
||||
final String? state,
|
||||
final int? duration,
|
||||
required final List<bool> type,
|
||||
final XFile? image,
|
||||
required final List<PacketOptions> options}) = _$CreatePlanModelImpl;
|
||||
const _CreatePlanModel._() : super._();
|
||||
|
||||
@override
|
||||
String? get name;
|
||||
@override
|
||||
String? get details;
|
||||
@override
|
||||
String? get state;
|
||||
@override
|
||||
int? get duration;
|
||||
@override
|
||||
List<bool> get type;
|
||||
@override
|
||||
XFile? get image;
|
||||
@override
|
||||
List<PacketOptions> get options;
|
||||
|
||||
/// Create a copy of CreatePlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CreatePlanModelImplCopyWith<_$CreatePlanModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,249 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'create_plan_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
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');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreatePlanState {
|
||||
bool get isLoading => throw _privateConstructorUsedError;
|
||||
String? get errorMessage => throw _privateConstructorUsedError;
|
||||
CreatePlanModel get planData => throw _privateConstructorUsedError;
|
||||
int? get durationIndex => throw _privateConstructorUsedError;
|
||||
int? get selectedOptionIndex => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CreatePlanState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CreatePlanStateCopyWith<CreatePlanState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CreatePlanStateCopyWith<$Res> {
|
||||
factory $CreatePlanStateCopyWith(
|
||||
CreatePlanState value, $Res Function(CreatePlanState) then) =
|
||||
_$CreatePlanStateCopyWithImpl<$Res, CreatePlanState>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool isLoading,
|
||||
String? errorMessage,
|
||||
CreatePlanModel planData,
|
||||
int? durationIndex,
|
||||
int? selectedOptionIndex});
|
||||
|
||||
$CreatePlanModelCopyWith<$Res> get planData;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CreatePlanStateCopyWithImpl<$Res, $Val extends CreatePlanState>
|
||||
implements $CreatePlanStateCopyWith<$Res> {
|
||||
_$CreatePlanStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CreatePlanState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isLoading = null,
|
||||
Object? errorMessage = freezed,
|
||||
Object? planData = null,
|
||||
Object? durationIndex = freezed,
|
||||
Object? selectedOptionIndex = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
isLoading: null == isLoading
|
||||
? _value.isLoading
|
||||
: isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
errorMessage: freezed == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
planData: null == planData
|
||||
? _value.planData
|
||||
: planData // ignore: cast_nullable_to_non_nullable
|
||||
as CreatePlanModel,
|
||||
durationIndex: freezed == durationIndex
|
||||
? _value.durationIndex
|
||||
: durationIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
selectedOptionIndex: freezed == selectedOptionIndex
|
||||
? _value.selectedOptionIndex
|
||||
: selectedOptionIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of CreatePlanState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$CreatePlanModelCopyWith<$Res> get planData {
|
||||
return $CreatePlanModelCopyWith<$Res>(_value.planData, (value) {
|
||||
return _then(_value.copyWith(planData: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CreatePlanStateImplCopyWith<$Res>
|
||||
implements $CreatePlanStateCopyWith<$Res> {
|
||||
factory _$$CreatePlanStateImplCopyWith(_$CreatePlanStateImpl value,
|
||||
$Res Function(_$CreatePlanStateImpl) then) =
|
||||
__$$CreatePlanStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool isLoading,
|
||||
String? errorMessage,
|
||||
CreatePlanModel planData,
|
||||
int? durationIndex,
|
||||
int? selectedOptionIndex});
|
||||
|
||||
@override
|
||||
$CreatePlanModelCopyWith<$Res> get planData;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CreatePlanStateImplCopyWithImpl<$Res>
|
||||
extends _$CreatePlanStateCopyWithImpl<$Res, _$CreatePlanStateImpl>
|
||||
implements _$$CreatePlanStateImplCopyWith<$Res> {
|
||||
__$$CreatePlanStateImplCopyWithImpl(
|
||||
_$CreatePlanStateImpl _value, $Res Function(_$CreatePlanStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CreatePlanState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isLoading = null,
|
||||
Object? errorMessage = freezed,
|
||||
Object? planData = null,
|
||||
Object? durationIndex = freezed,
|
||||
Object? selectedOptionIndex = freezed,
|
||||
}) {
|
||||
return _then(_$CreatePlanStateImpl(
|
||||
isLoading: null == isLoading
|
||||
? _value.isLoading
|
||||
: isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
errorMessage: freezed == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
planData: null == planData
|
||||
? _value.planData
|
||||
: planData // ignore: cast_nullable_to_non_nullable
|
||||
as CreatePlanModel,
|
||||
durationIndex: freezed == durationIndex
|
||||
? _value.durationIndex
|
||||
: durationIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
selectedOptionIndex: freezed == selectedOptionIndex
|
||||
? _value.selectedOptionIndex
|
||||
: selectedOptionIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CreatePlanStateImpl implements _CreatePlanState {
|
||||
const _$CreatePlanStateImpl(
|
||||
{required this.isLoading,
|
||||
required this.errorMessage,
|
||||
required this.planData,
|
||||
this.durationIndex,
|
||||
this.selectedOptionIndex});
|
||||
|
||||
@override
|
||||
final bool isLoading;
|
||||
@override
|
||||
final String? errorMessage;
|
||||
@override
|
||||
final CreatePlanModel planData;
|
||||
@override
|
||||
final int? durationIndex;
|
||||
@override
|
||||
final int? selectedOptionIndex;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreatePlanState(isLoading: $isLoading, errorMessage: $errorMessage, planData: $planData, durationIndex: $durationIndex, selectedOptionIndex: $selectedOptionIndex)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CreatePlanStateImpl &&
|
||||
(identical(other.isLoading, isLoading) ||
|
||||
other.isLoading == isLoading) &&
|
||||
(identical(other.errorMessage, errorMessage) ||
|
||||
other.errorMessage == errorMessage) &&
|
||||
(identical(other.planData, planData) ||
|
||||
other.planData == planData) &&
|
||||
(identical(other.durationIndex, durationIndex) ||
|
||||
other.durationIndex == durationIndex) &&
|
||||
(identical(other.selectedOptionIndex, selectedOptionIndex) ||
|
||||
other.selectedOptionIndex == selectedOptionIndex));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, isLoading, errorMessage,
|
||||
planData, durationIndex, selectedOptionIndex);
|
||||
|
||||
/// Create a copy of CreatePlanState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CreatePlanStateImplCopyWith<_$CreatePlanStateImpl> get copyWith =>
|
||||
__$$CreatePlanStateImplCopyWithImpl<_$CreatePlanStateImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CreatePlanState implements CreatePlanState {
|
||||
const factory _CreatePlanState(
|
||||
{required final bool isLoading,
|
||||
required final String? errorMessage,
|
||||
required final CreatePlanModel planData,
|
||||
final int? durationIndex,
|
||||
final int? selectedOptionIndex}) = _$CreatePlanStateImpl;
|
||||
|
||||
@override
|
||||
bool get isLoading;
|
||||
@override
|
||||
String? get errorMessage;
|
||||
@override
|
||||
CreatePlanModel get planData;
|
||||
@override
|
||||
int? get durationIndex;
|
||||
@override
|
||||
int? get selectedOptionIndex;
|
||||
|
||||
/// Create a copy of CreatePlanState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CreatePlanStateImplCopyWith<_$CreatePlanStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'create_plan_service.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RetrofitGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _CreatePlanService implements CreatePlanService {
|
||||
_CreatePlanService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
String? baseUrl;
|
||||
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<void> createPlan({required Map<String, dynamic> model}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createPacketOption({
|
||||
required String slug,
|
||||
required Map<String, dynamic> model,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create/${slug}/packet_option',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createPacketOptions({
|
||||
required String slug,
|
||||
required Map<String, dynamic> model,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create/${slug}/packet_options',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||
if (T != dynamic &&
|
||||
!(requestOptions.responseType == ResponseType.bytes ||
|
||||
requestOptions.responseType == ResponseType.stream)) {
|
||||
if (T == String) {
|
||||
requestOptions.responseType = ResponseType.plain;
|
||||
} else {
|
||||
requestOptions.responseType = ResponseType.json;
|
||||
}
|
||||
}
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
final url = Uri.parse(baseUrl);
|
||||
|
||||
if (url.isAbsolute) {
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
return Uri.parse(dioBaseUrl).resolveUri(url).toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user