init method
Pre-initializes the _userId
, so that it is accessible synchronously.
Implementation
Future<void> init() async {
await _guard.protect(() async {
if (_initialized) {
return;
}
_userId = await read();
_initialized = true;
});
}