key method

  1. @override
Future<String> key({
  1. required int index,
})

When passed a number index, returns the name of the nth key in a given Storage object. The order of keys is user-agent defined, so you should not rely on it.

NOTE for Web: this method will have effect only if the iframe has the same origin.

Officially Supported Platforms/Implementations:

  • Android native WebView
  • iOS
  • MacOS
  • Web

Implementation

@override
Future<String> key({required int index}) async {
  var result = await controller?.evaluateJavascript(source: """
  window.$webStorageType.key($index);
  """);
  return result != null ? json.decode(result) : null;
}