Created
June 6, 2020 06:43
-
-
Save ashishrawat2911/d15863bfdfe109241b65706b3ffe76fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GENERATED CODE - DO NOT MODIFY BY HAND | |
// ignore_for_file: deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named | |
part of 'result.dart'; | |
// ************************************************************************** | |
// FreezedGenerator | |
// ************************************************************************** | |
T _$identity<T>(T value) => value; | |
class _$ResultTearOff { | |
const _$ResultTearOff(); | |
Idle<T> idle<T>() { | |
return Idle<T>(); | |
} | |
Loading<T> loading<T>() { | |
return Loading<T>(); | |
} | |
Success<T> success<T>({@required T data}) { | |
return Success<T>( | |
data: data, | |
); | |
} | |
Failure<T> failure<T>({@required String reason}) { | |
return Failure<T>( | |
reason: reason, | |
); | |
} | |
} | |
// ignore: unused_element | |
const $Result = _$ResultTearOff(); | |
mixin _$Result<T> { | |
@optionalTypeArgs | |
Result when<Result extends Object>({ | |
@required Result idle(), | |
@required Result loading(), | |
@required Result success(T data), | |
@required Result failure(String reason), | |
}); | |
@optionalTypeArgs | |
Result maybeWhen<Result extends Object>({ | |
Result idle(), | |
Result loading(), | |
Result success(T data), | |
Result failure(String reason), | |
@required Result orElse(), | |
}); | |
@optionalTypeArgs | |
Result map<Result extends Object>({ | |
@required Result idle(Idle<T> value), | |
@required Result loading(Loading<T> value), | |
@required Result success(Success<T> value), | |
@required Result failure(Failure<T> value), | |
}); | |
@optionalTypeArgs | |
Result maybeMap<Result extends Object>({ | |
Result idle(Idle<T> value), | |
Result loading(Loading<T> value), | |
Result success(Success<T> value), | |
Result failure(Failure<T> value), | |
@required Result orElse(), | |
}); | |
} | |
abstract class $ResultCopyWith<T, $Res> { | |
factory $ResultCopyWith(Result<T> value, $Res Function(Result<T>) then) = | |
_$ResultCopyWithImpl<T, $Res>; | |
} | |
class _$ResultCopyWithImpl<T, $Res> implements $ResultCopyWith<T, $Res> { | |
_$ResultCopyWithImpl(this._value, this._then); | |
final Result<T> _value; | |
// ignore: unused_field | |
final $Res Function(Result<T>) _then; | |
} | |
abstract class $IdleCopyWith<T, $Res> { | |
factory $IdleCopyWith(Idle<T> value, $Res Function(Idle<T>) then) = | |
_$IdleCopyWithImpl<T, $Res>; | |
} | |
class _$IdleCopyWithImpl<T, $Res> extends _$ResultCopyWithImpl<T, $Res> | |
implements $IdleCopyWith<T, $Res> { | |
_$IdleCopyWithImpl(Idle<T> _value, $Res Function(Idle<T>) _then) | |
: super(_value, (v) => _then(v as Idle<T>)); | |
@override | |
Idle<T> get _value => super._value as Idle<T>; | |
} | |
class _$Idle<T> with DiagnosticableTreeMixin implements Idle<T> { | |
const _$Idle(); | |
@override | |
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { | |
return 'Result<$T>.idle()'; | |
} | |
@override | |
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | |
super.debugFillProperties(properties); | |
properties..add(DiagnosticsProperty('type', 'Result<$T>.idle')); | |
} | |
@override | |
bool operator ==(dynamic other) { | |
return identical(this, other) || (other is Idle<T>); | |
} | |
@override | |
int get hashCode => runtimeType.hashCode; | |
@override | |
@optionalTypeArgs | |
Result when<Result extends Object>({ | |
@required Result idle(), | |
@required Result loading(), | |
@required Result success(T data), | |
@required Result failure(String reason), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return idle(); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeWhen<Result extends Object>({ | |
Result idle(), | |
Result loading(), | |
Result success(T data), | |
Result failure(String reason), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (idle != null) { | |
return idle(); | |
} | |
return orElse(); | |
} | |
@override | |
@optionalTypeArgs | |
Result map<Result extends Object>({ | |
@required Result idle(Idle<T> value), | |
@required Result loading(Loading<T> value), | |
@required Result success(Success<T> value), | |
@required Result failure(Failure<T> value), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return idle(this); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeMap<Result extends Object>({ | |
Result idle(Idle<T> value), | |
Result loading(Loading<T> value), | |
Result success(Success<T> value), | |
Result failure(Failure<T> value), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (idle != null) { | |
return idle(this); | |
} | |
return orElse(); | |
} | |
} | |
abstract class Idle<T> implements Result<T> { | |
const factory Idle() = _$Idle<T>; | |
} | |
abstract class $LoadingCopyWith<T, $Res> { | |
factory $LoadingCopyWith(Loading<T> value, $Res Function(Loading<T>) then) = | |
_$LoadingCopyWithImpl<T, $Res>; | |
} | |
class _$LoadingCopyWithImpl<T, $Res> extends _$ResultCopyWithImpl<T, $Res> | |
implements $LoadingCopyWith<T, $Res> { | |
_$LoadingCopyWithImpl(Loading<T> _value, $Res Function(Loading<T>) _then) | |
: super(_value, (v) => _then(v as Loading<T>)); | |
@override | |
Loading<T> get _value => super._value as Loading<T>; | |
} | |
class _$Loading<T> with DiagnosticableTreeMixin implements Loading<T> { | |
const _$Loading(); | |
@override | |
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { | |
return 'Result<$T>.loading()'; | |
} | |
@override | |
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | |
super.debugFillProperties(properties); | |
properties..add(DiagnosticsProperty('type', 'Result<$T>.loading')); | |
} | |
@override | |
bool operator ==(dynamic other) { | |
return identical(this, other) || (other is Loading<T>); | |
} | |
@override | |
int get hashCode => runtimeType.hashCode; | |
@override | |
@optionalTypeArgs | |
Result when<Result extends Object>({ | |
@required Result idle(), | |
@required Result loading(), | |
@required Result success(T data), | |
@required Result failure(String reason), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return loading(); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeWhen<Result extends Object>({ | |
Result idle(), | |
Result loading(), | |
Result success(T data), | |
Result failure(String reason), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (loading != null) { | |
return loading(); | |
} | |
return orElse(); | |
} | |
@override | |
@optionalTypeArgs | |
Result map<Result extends Object>({ | |
@required Result idle(Idle<T> value), | |
@required Result loading(Loading<T> value), | |
@required Result success(Success<T> value), | |
@required Result failure(Failure<T> value), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return loading(this); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeMap<Result extends Object>({ | |
Result idle(Idle<T> value), | |
Result loading(Loading<T> value), | |
Result success(Success<T> value), | |
Result failure(Failure<T> value), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (loading != null) { | |
return loading(this); | |
} | |
return orElse(); | |
} | |
} | |
abstract class Loading<T> implements Result<T> { | |
const factory Loading() = _$Loading<T>; | |
} | |
abstract class $SuccessCopyWith<T, $Res> { | |
factory $SuccessCopyWith(Success<T> value, $Res Function(Success<T>) then) = | |
_$SuccessCopyWithImpl<T, $Res>; | |
$Res call({T data}); | |
} | |
class _$SuccessCopyWithImpl<T, $Res> extends _$ResultCopyWithImpl<T, $Res> | |
implements $SuccessCopyWith<T, $Res> { | |
_$SuccessCopyWithImpl(Success<T> _value, $Res Function(Success<T>) _then) | |
: super(_value, (v) => _then(v as Success<T>)); | |
@override | |
Success<T> get _value => super._value as Success<T>; | |
@override | |
$Res call({ | |
Object data = freezed, | |
}) { | |
return _then(Success<T>( | |
data: data == freezed ? _value.data : data as T, | |
)); | |
} | |
} | |
class _$Success<T> with DiagnosticableTreeMixin implements Success<T> { | |
const _$Success({@required this.data}) : assert(data != null); | |
@override | |
final T data; | |
@override | |
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { | |
return 'Result<$T>.success(data: $data)'; | |
} | |
@override | |
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | |
super.debugFillProperties(properties); | |
properties | |
..add(DiagnosticsProperty('type', 'Result<$T>.success')) | |
..add(DiagnosticsProperty('data', data)); | |
} | |
@override | |
bool operator ==(dynamic other) { | |
return identical(this, other) || | |
(other is Success<T> && | |
(identical(other.data, data) || | |
const DeepCollectionEquality().equals(other.data, data))); | |
} | |
@override | |
int get hashCode => | |
runtimeType.hashCode ^ const DeepCollectionEquality().hash(data); | |
@override | |
$SuccessCopyWith<T, Success<T>> get copyWith => | |
_$SuccessCopyWithImpl<T, Success<T>>(this, _$identity); | |
@override | |
@optionalTypeArgs | |
Result when<Result extends Object>({ | |
@required Result idle(), | |
@required Result loading(), | |
@required Result success(T data), | |
@required Result failure(String reason), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return success(data); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeWhen<Result extends Object>({ | |
Result idle(), | |
Result loading(), | |
Result success(T data), | |
Result failure(String reason), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (success != null) { | |
return success(data); | |
} | |
return orElse(); | |
} | |
@override | |
@optionalTypeArgs | |
Result map<Result extends Object>({ | |
@required Result idle(Idle<T> value), | |
@required Result loading(Loading<T> value), | |
@required Result success(Success<T> value), | |
@required Result failure(Failure<T> value), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return success(this); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeMap<Result extends Object>({ | |
Result idle(Idle<T> value), | |
Result loading(Loading<T> value), | |
Result success(Success<T> value), | |
Result failure(Failure<T> value), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (success != null) { | |
return success(this); | |
} | |
return orElse(); | |
} | |
} | |
abstract class Success<T> implements Result<T> { | |
const factory Success({@required T data}) = _$Success<T>; | |
T get data; | |
$SuccessCopyWith<T, Success<T>> get copyWith; | |
} | |
abstract class $FailureCopyWith<T, $Res> { | |
factory $FailureCopyWith(Failure<T> value, $Res Function(Failure<T>) then) = | |
_$FailureCopyWithImpl<T, $Res>; | |
$Res call({String reason}); | |
} | |
class _$FailureCopyWithImpl<T, $Res> extends _$ResultCopyWithImpl<T, $Res> | |
implements $FailureCopyWith<T, $Res> { | |
_$FailureCopyWithImpl(Failure<T> _value, $Res Function(Failure<T>) _then) | |
: super(_value, (v) => _then(v as Failure<T>)); | |
@override | |
Failure<T> get _value => super._value as Failure<T>; | |
@override | |
$Res call({ | |
Object reason = freezed, | |
}) { | |
return _then(Failure<T>( | |
reason: reason == freezed ? _value.reason : reason as String, | |
)); | |
} | |
} | |
class _$Failure<T> with DiagnosticableTreeMixin implements Failure<T> { | |
const _$Failure({@required this.reason}) : assert(reason != null); | |
@override | |
final String reason; | |
@override | |
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { | |
return 'Result<$T>.failure(reason: $reason)'; | |
} | |
@override | |
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | |
super.debugFillProperties(properties); | |
properties | |
..add(DiagnosticsProperty('type', 'Result<$T>.failure')) | |
..add(DiagnosticsProperty('reason', reason)); | |
} | |
@override | |
bool operator ==(dynamic other) { | |
return identical(this, other) || | |
(other is Failure<T> && | |
(identical(other.reason, reason) || | |
const DeepCollectionEquality().equals(other.reason, reason))); | |
} | |
@override | |
int get hashCode => | |
runtimeType.hashCode ^ const DeepCollectionEquality().hash(reason); | |
@override | |
$FailureCopyWith<T, Failure<T>> get copyWith => | |
_$FailureCopyWithImpl<T, Failure<T>>(this, _$identity); | |
@override | |
@optionalTypeArgs | |
Result when<Result extends Object>({ | |
@required Result idle(), | |
@required Result loading(), | |
@required Result success(T data), | |
@required Result failure(String reason), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return failure(reason); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeWhen<Result extends Object>({ | |
Result idle(), | |
Result loading(), | |
Result success(T data), | |
Result failure(String reason), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (failure != null) { | |
return failure(reason); | |
} | |
return orElse(); | |
} | |
@override | |
@optionalTypeArgs | |
Result map<Result extends Object>({ | |
@required Result idle(Idle<T> value), | |
@required Result loading(Loading<T> value), | |
@required Result success(Success<T> value), | |
@required Result failure(Failure<T> value), | |
}) { | |
assert(idle != null); | |
assert(loading != null); | |
assert(success != null); | |
assert(failure != null); | |
return failure(this); | |
} | |
@override | |
@optionalTypeArgs | |
Result maybeMap<Result extends Object>({ | |
Result idle(Idle<T> value), | |
Result loading(Loading<T> value), | |
Result success(Success<T> value), | |
Result failure(Failure<T> value), | |
@required Result orElse(), | |
}) { | |
assert(orElse != null); | |
if (failure != null) { | |
return failure(this); | |
} | |
return orElse(); | |
} | |
} | |
abstract class Failure<T> implements Result<T> { | |
const factory Failure({@required String reason}) = _$Failure<T>; | |
String get reason; | |
$FailureCopyWith<T, Failure<T>> get copyWith; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment