create static method
Future<SDNImageFile>
create({
- required Uint8List bytes,
- required String name,
- String? mimeType,
- @Deprecated('Use [nativeImplementations] instead') ComputeRunner? compute,
- NativeImplementations nativeImplementations = NativeImplementations.dummy,
Creates a new image file and calculates the width, height and blurhash.
Implementation
static Future<SDNImageFile> create({
required Uint8List bytes,
required String name,
String? mimeType,
@Deprecated('Use [nativeImplementations] instead') ComputeRunner? compute,
NativeImplementations nativeImplementations = NativeImplementations.dummy,
}) async {
if (compute != null) {
nativeImplementations =
NativeImplementationsIsolate.fromRunInBackground(compute);
}
final metaData = await nativeImplementations.calcImageMetadata(bytes);
return SDNImageFile(
bytes: metaData?.bytes ?? bytes,
name: name,
mimeType: mimeType,
width: metaData?.width,
height: metaData?.height,
blurhash: metaData?.blurhash,
);
}