feat(authentication): add custom routine, and documentation

This commit is contained in:
2023-04-13 23:24:11 +02:00
parent eafe4dc7c6
commit 3faceeebb6
19 changed files with 331 additions and 424 deletions
@@ -30,19 +30,6 @@ import 'package:go_router/go_router.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
// FutureOrResult<int?> onAccountChanges(
// AuthenticationRepository<int> repo,
// AuthChangeEvent? authEvent,
// ) async {
// final id = Random().nextInt(1000);
// final token =
// await repo.getIdentityToken().fold((value) => value, (error) => 'null');
// debugPrint(
// 'onAccountChanges: ${authEvent?.account}, type: ${authEvent.runtimeType}, token: $token, generatedId: $id');
// return Ok<int, AppException>(id);
// }
class App extends StatelessWidget {
final AuthenticationRepository<int> authenticationRepository =
AuthenticationRepositoryImpl(
@@ -64,7 +51,9 @@ class App extends StatelessWidget {
Widget build(BuildContext context) {
AuthenticationState<int>? previous;
final AuthenticationCubit<int> authenticationCubit = ExampleAuthenticationCubit(authenticationRepository: authenticationRepository);
final AuthenticationCubit<int> authenticationCubit =
ExampleAuthenticationCubit(
authenticationRepository: authenticationRepository);
final GoRouter router = GoRouter(
initialLocation: '/',
@@ -91,7 +80,7 @@ class App extends StatelessWidget {
return '/home';
}
}
return null;
return state.name;
},
);