write method Null safety

Future<void> write(
  1. String path,
  2. Uint8List obj,
  3. {int retries = 3}
)

Implementation

Future<void> write(String path, Uint8List obj, {int retries = 3}) async {
  policy ??= await _l0storageService.policy();
  try {
    await _repository.upload(
        '${policy!.keyPrefix}$path', policy!.fields!, obj);
  } on WasabiExceptionExpired catch (_) {
    policy = await _l0storageService.policy();
    await _repository.upload(
        '${policy!.keyPrefix}$path', policy!.fields!, obj);
  } on SocketException catch (_) {
    if (retries > 0) {
      return write(path, obj, retries: retries - 1);
    } else {
      rethrow;
    }
  }
}