setFromBytes method

Future<void> setFromBytes({
  1. required String name,
  2. required String extension,
  3. required Uint8List? bytes,
})

Implementation

Future<void> setFromBytes({required final String name, required final String extension, required final Uint8List? bytes}) async {
  if(bytes == null) throw Exception("bytes cant be null");
  await PlatformTools().w(name: name, extension: extension, bytes: bytes).then((_f) {
    _file      = _f;
    _bytes     = bytes;
    _error     = false;
    _hasImage  = true;
    _extension = extension;
    notifyListeners();
  }).onError((error, stackTrace) => _reset(error: true));
}