saveAsBytes method

Future<String> saveAsBytes(
  1. String filename,
  2. List<int> bytes
)

Saves the provided bytes as a file with the specified filename.

Returns a Future that completes with the saved file path.

Implementation

Future<String> saveAsBytes(String filename, List<int> bytes) async {
  try {
    final file = await _file(filename);
    await file.writeAsBytes(bytes);
    return file.path;
  } catch (_) {
    try {
      return _ref(filename);
    } catch (__) {
      return "";
    }
  }
}