writeAsBytes method Null safety

Future<File?> writeAsBytes(
  1. String path,
  2. Uint8List data
)

Implementation

static Future<File?> writeAsBytes(String path, Uint8List data) async {
  try {
    File file = File(path);
    file = await file.writeAsBytes(data);
    return file;
  } catch (e) {
    return null;
  }
}