fromUint8List method

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

Creates image data from raw bytes and a file name.

Implementation

Future<void> fromUint8List({
  required final Uint8List  bytes,
  required final String     name,
  final String? key
}) async {
  // Update key if provided
  if(key != null) updateKey(key);
  // Start loading indicator
  startLoading();
  // Create Data Transfer Object from raw bytes
  await _useCase
  .createDTO(
    key     : _key,
    maxSize : _maxSize,
    data    : bytes,
    path    : "blob/$name",
  )
  .then(_setData)          // Update image data on success
  .onError(_setError)      // Handle errors
  .whenComplete(() => stopLoading() ); // Stop loading indicator
}