signIn method Null safety

Future<void> signIn(
  1. {required String code,
  2. required String password}
)

Signs in with the provided code and password.

Emits an authenticated status if successful. Throws a SignInFailure if the server does not respond ok.

Implementation

Future<void> signIn({
  required String code,
  required String password,
}) async {
  final response = await _requestSignIn(code, password);
  if (response.statusCode == 302) {
    await _storageProvider.setCode(code);
    await _storageProvider.setToken(password);
    _controller.add(AuthenticationStatus.authenticated);
  } else {
    throw SignInFailure.fromCode(response.statusCode);
  }
}