get method

  1. @override
Future<Uint8List> get(
  1. String path
)
override

Reads and returns the data from a path as a Uint8List.

If the file does not exist, an empty Uint8List should be returned.

Implementation

@override
Future<Uint8List> get(String path) async {
  final key = path.replaceFirst('{document}', 'document');
  final value = _localStorage.getItem(key);

  if (value == null) {
    // Match the behavior of the IO implementation, returning an empty list
    // instead of throwing an error.
    return Uint8List(0);
  }

  return base64Decode(value);
}