ImageAsset.makeAsset constructor

ImageAsset.makeAsset(
  1. File file, {
  2. String? name,
})

Implementation

factory ImageAsset.makeAsset(File file, {String? name}) {
  if (!file.existsSync()) {
    throw ArgumentError('File does not exist');
  }

  final hash = file.hashCode.toRadixString(16);
  final fragments = ['attachments', 'files', hash];

  return ImageAsset(fragments, hash);
}