login method

Future<void> login(
  1. String? token
)

Save token, will be used throughout the app for authentication

Implementation

Future<void> login(String? token) async {
  assert(token != null && token.isNotEmpty);

  _token = token;
  try {
    await _storage!.write(key: 'token', value: token);
  } catch (_) {
    /// TODO: handle the [PlatformException] here
  }
}