getJson<T> method

Future<T?> getJson<T>({
  1. String? streamId,
})

Implementation

Future<T?> getJson<T>({String? streamId}) async {
  if (!exists) {
    throw StorageDatabaseException("The file ($filename) not exists yet.");
  }
  try {
    String strData = await get(streamId: streamId);
    if (strData.isNotEmpty) {
      return jsonDecode(strData);
    } else {
      return null;
    }
  } catch (e) {
    dev.log("[StorageDatabase.StorageExplorer.ExplorerFile.getJson]: $e");
    throw StorageDatabaseException("Can't decode file ($filename) content.");
  }
}