Приложение на флаторе, настройки
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'auth_event.dart';
|
||||
import 'auth_state.dart';
|
||||
|
||||
class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
AuthBloc() : super(const AuthState.initial()) {
|
||||
on<AuthEventStarted>(_onStarted);
|
||||
on<AuthEventLoginRequested>(_onLoginRequested);
|
||||
on<AuthEventRegisterRequested>(_onRegisterRequested);
|
||||
on<AuthEventLogoutRequested>(_onLogoutRequested);
|
||||
on<AuthEventAuthChecked>(_onAuthChecked);
|
||||
on<AuthEventEmailChanged>(_onEmailChanged);
|
||||
on<AuthEventPasswordChanged>(_onPasswordChanged);
|
||||
on<AuthEventNameChanged>(_onNameChanged);
|
||||
}
|
||||
|
||||
Future<void> _onStarted(AuthEventStarted event, emit) async {}
|
||||
|
||||
Future<void> _onLoginRequested(AuthEventLoginRequested event, emit) async {
|
||||
emit(const AuthState.loading());
|
||||
emit(const AuthState.authenticated('user_123'));
|
||||
}
|
||||
|
||||
Future<void> _onRegisterRequested(AuthEventRegisterRequested event, emit) async {
|
||||
emit(const AuthState.loading());
|
||||
}
|
||||
|
||||
Future<void> _onLogoutRequested(AuthEventLogoutRequested event, emit) async {
|
||||
emit(const AuthState.unauthenticated());
|
||||
}
|
||||
|
||||
Future<void> _onAuthChecked(AuthEventAuthChecked event, emit) async {}
|
||||
void _onEmailChanged(AuthEventEmailChanged event, emit) {}
|
||||
void _onPasswordChanged(AuthEventPasswordChanged event, emit) {}
|
||||
void _onNameChanged(AuthEventNameChanged event, emit) {}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth_event.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class AuthEvent with _$AuthEvent {
|
||||
const factory AuthEvent.started() = AuthEventStarted;
|
||||
const factory AuthEvent.loginRequested(String email, String password) = AuthEventLoginRequested;
|
||||
const factory AuthEvent.registerRequested(String email, String password, String name) = AuthEventRegisterRequested;
|
||||
const factory AuthEvent.logoutRequested() = AuthEventLogoutRequested;
|
||||
const factory AuthEvent.authChecked() = AuthEventAuthChecked;
|
||||
const factory AuthEvent.emailChanged(String email) = AuthEventEmailChanged;
|
||||
const factory AuthEvent.passwordChanged(String password) = AuthEventPasswordChanged;
|
||||
const factory AuthEvent.nameChanged(String name) = AuthEventNameChanged;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class AuthState with _$AuthState {
|
||||
const factory AuthState.initial() = AuthInitial;
|
||||
const factory AuthState.loading() = AuthLoading;
|
||||
const factory AuthState.authenticated(String userId) = AuthAuthenticated;
|
||||
const factory AuthState.unauthenticated() = AuthUnauthenticated;
|
||||
const factory AuthState.error(String message) = AuthError;
|
||||
}
|
||||
@@ -0,0 +1,757 @@
|
||||
// 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 'auth_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 _$AuthState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String userId) authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function(String message) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String userId)? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function(String message)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String userId)? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(AuthInitial value) initial,
|
||||
required TResult Function(AuthLoading value) loading,
|
||||
required TResult Function(AuthAuthenticated value) authenticated,
|
||||
required TResult Function(AuthUnauthenticated value) unauthenticated,
|
||||
required TResult Function(AuthError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(AuthInitial value)? initial,
|
||||
TResult? Function(AuthLoading value)? loading,
|
||||
TResult? Function(AuthAuthenticated value)? authenticated,
|
||||
TResult? Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult? Function(AuthError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(AuthInitial value)? initial,
|
||||
TResult Function(AuthLoading value)? loading,
|
||||
TResult Function(AuthAuthenticated value)? authenticated,
|
||||
TResult Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult Function(AuthError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AuthStateCopyWith<$Res> {
|
||||
factory $AuthStateCopyWith(AuthState value, $Res Function(AuthState) then) =
|
||||
_$AuthStateCopyWithImpl<$Res, AuthState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState>
|
||||
implements $AuthStateCopyWith<$Res> {
|
||||
_$AuthStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthInitialImplCopyWith<$Res> {
|
||||
factory _$$AuthInitialImplCopyWith(
|
||||
_$AuthInitialImpl value, $Res Function(_$AuthInitialImpl) then) =
|
||||
__$$AuthInitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthInitialImplCopyWithImpl<$Res>
|
||||
extends _$AuthStateCopyWithImpl<$Res, _$AuthInitialImpl>
|
||||
implements _$$AuthInitialImplCopyWith<$Res> {
|
||||
__$$AuthInitialImplCopyWithImpl(
|
||||
_$AuthInitialImpl _value, $Res Function(_$AuthInitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthInitialImpl implements AuthInitial {
|
||||
const _$AuthInitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$AuthInitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String userId) authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String userId)? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String userId)? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(AuthInitial value) initial,
|
||||
required TResult Function(AuthLoading value) loading,
|
||||
required TResult Function(AuthAuthenticated value) authenticated,
|
||||
required TResult Function(AuthUnauthenticated value) unauthenticated,
|
||||
required TResult Function(AuthError value) error,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(AuthInitial value)? initial,
|
||||
TResult? Function(AuthLoading value)? loading,
|
||||
TResult? Function(AuthAuthenticated value)? authenticated,
|
||||
TResult? Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult? Function(AuthError value)? error,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(AuthInitial value)? initial,
|
||||
TResult Function(AuthLoading value)? loading,
|
||||
TResult Function(AuthAuthenticated value)? authenticated,
|
||||
TResult Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult Function(AuthError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AuthInitial implements AuthState {
|
||||
const factory AuthInitial() = _$AuthInitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthLoadingImplCopyWith<$Res> {
|
||||
factory _$$AuthLoadingImplCopyWith(
|
||||
_$AuthLoadingImpl value, $Res Function(_$AuthLoadingImpl) then) =
|
||||
__$$AuthLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthLoadingImplCopyWithImpl<$Res>
|
||||
extends _$AuthStateCopyWithImpl<$Res, _$AuthLoadingImpl>
|
||||
implements _$$AuthLoadingImplCopyWith<$Res> {
|
||||
__$$AuthLoadingImplCopyWithImpl(
|
||||
_$AuthLoadingImpl _value, $Res Function(_$AuthLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthLoadingImpl implements AuthLoading {
|
||||
const _$AuthLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$AuthLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String userId) authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String userId)? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String userId)? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(AuthInitial value) initial,
|
||||
required TResult Function(AuthLoading value) loading,
|
||||
required TResult Function(AuthAuthenticated value) authenticated,
|
||||
required TResult Function(AuthUnauthenticated value) unauthenticated,
|
||||
required TResult Function(AuthError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(AuthInitial value)? initial,
|
||||
TResult? Function(AuthLoading value)? loading,
|
||||
TResult? Function(AuthAuthenticated value)? authenticated,
|
||||
TResult? Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult? Function(AuthError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(AuthInitial value)? initial,
|
||||
TResult Function(AuthLoading value)? loading,
|
||||
TResult Function(AuthAuthenticated value)? authenticated,
|
||||
TResult Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult Function(AuthError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AuthLoading implements AuthState {
|
||||
const factory AuthLoading() = _$AuthLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthAuthenticatedImplCopyWith<$Res> {
|
||||
factory _$$AuthAuthenticatedImplCopyWith(_$AuthAuthenticatedImpl value,
|
||||
$Res Function(_$AuthAuthenticatedImpl) then) =
|
||||
__$$AuthAuthenticatedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String userId});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthAuthenticatedImplCopyWithImpl<$Res>
|
||||
extends _$AuthStateCopyWithImpl<$Res, _$AuthAuthenticatedImpl>
|
||||
implements _$$AuthAuthenticatedImplCopyWith<$Res> {
|
||||
__$$AuthAuthenticatedImplCopyWithImpl(_$AuthAuthenticatedImpl _value,
|
||||
$Res Function(_$AuthAuthenticatedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? userId = null,
|
||||
}) {
|
||||
return _then(_$AuthAuthenticatedImpl(
|
||||
null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthAuthenticatedImpl implements AuthAuthenticated {
|
||||
const _$AuthAuthenticatedImpl(this.userId);
|
||||
|
||||
@override
|
||||
final String userId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthState.authenticated(userId: $userId)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthAuthenticatedImpl &&
|
||||
(identical(other.userId, userId) || other.userId == userId));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, userId);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthAuthenticatedImplCopyWith<_$AuthAuthenticatedImpl> get copyWith =>
|
||||
__$$AuthAuthenticatedImplCopyWithImpl<_$AuthAuthenticatedImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String userId) authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return authenticated(userId);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String userId)? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return authenticated?.call(userId);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String userId)? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (authenticated != null) {
|
||||
return authenticated(userId);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(AuthInitial value) initial,
|
||||
required TResult Function(AuthLoading value) loading,
|
||||
required TResult Function(AuthAuthenticated value) authenticated,
|
||||
required TResult Function(AuthUnauthenticated value) unauthenticated,
|
||||
required TResult Function(AuthError value) error,
|
||||
}) {
|
||||
return authenticated(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(AuthInitial value)? initial,
|
||||
TResult? Function(AuthLoading value)? loading,
|
||||
TResult? Function(AuthAuthenticated value)? authenticated,
|
||||
TResult? Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult? Function(AuthError value)? error,
|
||||
}) {
|
||||
return authenticated?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(AuthInitial value)? initial,
|
||||
TResult Function(AuthLoading value)? loading,
|
||||
TResult Function(AuthAuthenticated value)? authenticated,
|
||||
TResult Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult Function(AuthError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (authenticated != null) {
|
||||
return authenticated(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AuthAuthenticated implements AuthState {
|
||||
const factory AuthAuthenticated(final String userId) =
|
||||
_$AuthAuthenticatedImpl;
|
||||
|
||||
String get userId;
|
||||
@JsonKey(ignore: true)
|
||||
_$$AuthAuthenticatedImplCopyWith<_$AuthAuthenticatedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthUnauthenticatedImplCopyWith<$Res> {
|
||||
factory _$$AuthUnauthenticatedImplCopyWith(_$AuthUnauthenticatedImpl value,
|
||||
$Res Function(_$AuthUnauthenticatedImpl) then) =
|
||||
__$$AuthUnauthenticatedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthUnauthenticatedImplCopyWithImpl<$Res>
|
||||
extends _$AuthStateCopyWithImpl<$Res, _$AuthUnauthenticatedImpl>
|
||||
implements _$$AuthUnauthenticatedImplCopyWith<$Res> {
|
||||
__$$AuthUnauthenticatedImplCopyWithImpl(_$AuthUnauthenticatedImpl _value,
|
||||
$Res Function(_$AuthUnauthenticatedImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthUnauthenticatedImpl implements AuthUnauthenticated {
|
||||
const _$AuthUnauthenticatedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthState.unauthenticated()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthUnauthenticatedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String userId) authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return unauthenticated();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String userId)? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return unauthenticated?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String userId)? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (unauthenticated != null) {
|
||||
return unauthenticated();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(AuthInitial value) initial,
|
||||
required TResult Function(AuthLoading value) loading,
|
||||
required TResult Function(AuthAuthenticated value) authenticated,
|
||||
required TResult Function(AuthUnauthenticated value) unauthenticated,
|
||||
required TResult Function(AuthError value) error,
|
||||
}) {
|
||||
return unauthenticated(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(AuthInitial value)? initial,
|
||||
TResult? Function(AuthLoading value)? loading,
|
||||
TResult? Function(AuthAuthenticated value)? authenticated,
|
||||
TResult? Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult? Function(AuthError value)? error,
|
||||
}) {
|
||||
return unauthenticated?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(AuthInitial value)? initial,
|
||||
TResult Function(AuthLoading value)? loading,
|
||||
TResult Function(AuthAuthenticated value)? authenticated,
|
||||
TResult Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult Function(AuthError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (unauthenticated != null) {
|
||||
return unauthenticated(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AuthUnauthenticated implements AuthState {
|
||||
const factory AuthUnauthenticated() = _$AuthUnauthenticatedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthErrorImplCopyWith<$Res> {
|
||||
factory _$$AuthErrorImplCopyWith(
|
||||
_$AuthErrorImpl value, $Res Function(_$AuthErrorImpl) then) =
|
||||
__$$AuthErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String message});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthErrorImplCopyWithImpl<$Res>
|
||||
extends _$AuthStateCopyWithImpl<$Res, _$AuthErrorImpl>
|
||||
implements _$$AuthErrorImplCopyWith<$Res> {
|
||||
__$$AuthErrorImplCopyWithImpl(
|
||||
_$AuthErrorImpl _value, $Res Function(_$AuthErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? message = null,
|
||||
}) {
|
||||
return _then(_$AuthErrorImpl(
|
||||
null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthErrorImpl implements AuthError {
|
||||
const _$AuthErrorImpl(this.message);
|
||||
|
||||
@override
|
||||
final String message;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthState.error(message: $message)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthErrorImpl &&
|
||||
(identical(other.message, message) || other.message == message));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, message);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthErrorImplCopyWith<_$AuthErrorImpl> get copyWith =>
|
||||
__$$AuthErrorImplCopyWithImpl<_$AuthErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String userId) authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return error(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String userId)? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return error?.call(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String userId)? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(message);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(AuthInitial value) initial,
|
||||
required TResult Function(AuthLoading value) loading,
|
||||
required TResult Function(AuthAuthenticated value) authenticated,
|
||||
required TResult Function(AuthUnauthenticated value) unauthenticated,
|
||||
required TResult Function(AuthError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(AuthInitial value)? initial,
|
||||
TResult? Function(AuthLoading value)? loading,
|
||||
TResult? Function(AuthAuthenticated value)? authenticated,
|
||||
TResult? Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult? Function(AuthError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(AuthInitial value)? initial,
|
||||
TResult Function(AuthLoading value)? loading,
|
||||
TResult Function(AuthAuthenticated value)? authenticated,
|
||||
TResult Function(AuthUnauthenticated value)? unauthenticated,
|
||||
TResult Function(AuthError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AuthError implements AuthState {
|
||||
const factory AuthError(final String message) = _$AuthErrorImpl;
|
||||
|
||||
String get message;
|
||||
@JsonKey(ignore: true)
|
||||
_$$AuthErrorImplCopyWith<_$AuthErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user