mogol / flutter_secure_storage

A Flutter plugin to store data in secure storage
https://pub.dartlang.org/packages/flutter_secure_storage
BSD 3-Clause "New" or "Revised" License
1.09k stars 340 forks source link

Running on web fails when _selectOptions are called #745

Closed FilledStacks closed 3 days ago

FilledStacks commented 4 days ago

Using a Flutter web project, when I call

final  _accessToken = await storage.read(key: _kAccessTokenKey);

I then get the exception

Error: LateInitializationError: isLinux

This happens in the _selectOptions call on line 129 when checking for isLinux

Map<String, String>? _selectOptions(
      IOSOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions) {
    if (Platform.isLinux) { //<===== throws error
      return lOptions?.params;
    }
    return Platform.isIOS ? iOptions?.params : aOptions?.params;
  }

Is there initialization logic that I need to call to ensure this value is set?