getFile method Null safety

File getFile(
  1. Uri uri
)

Returns a File at uri, creates all parent directories recursively if necessary.

Implementation

File getFile(Uri uri) {
  final file = File.fromUri(uri);
  if (!file.parent.existsSync()) {
    file.parent.createSync(recursive: true);
  }

  return file;
}