onInit method Null safety

  1. @override
Future<void> onInit()
override

Load token when initialized

Implementation

@override
Future<void> onInit() async {
  final tokenJson = await _storage.get();
  if (tokenJson != null) {
    authToken(AuthToken.fromJson(tokenJson));
    workflowController.setAuthState(token.isSuccessful, token.tokenType);
  } else {
    workflowController.setAuthState(false);
  }
  super.onInit();
}