toUint8ListFromUrl property Null safety

Future<Uint8List?> toUint8ListFromUrl

Implementation

Future<Uint8List?> get toUint8ListFromUrl async {
  if (this.isNotEmpty) {
    File file = File(this);
    bool exist = await file.exists();
    if (exist) {
      Uint8List data = await file.readAsBytes();

      return data;
    } else {
      return null;
    }
  }
  return null;
}