readAsync method

  1. @override
Future<String> readAsync()
override

Implementation

@override
Future<String> readAsync() async {
  if (await _completerOpenDatabase.future) {}
  if (_isInitializedDatabase) {
    {
      final data = _database.transaction(
          pathToFile, _DatabaseIndexedOperationType.readonly.name);

      final ob = data.objectStore(pathToFile);
      final result = await ob.getObject(pathToFile);
      if (result is String) {
        if (result.isEmpty) {
          return "{}";
        }
        return result;
      }
    }
  }
  return "";
}