setFromBytes method

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

Implementation

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