Flutter Web How to Convert Uint8List to File

Viewed 4360

I am having trouble on converting Uint8List image to File on flutter web since dart:io is not supported on the web, i need it to be file in order to upload it to FirebaseStorage, is there any workaround for this ? thankyou

1 Answers

Since dart:io isn't avalible on web, you can use the universal_io package.

Add it to your pubspec.yaml.

import 'package:universal_io/io.dart';

File createFileFromBytes(Uint8List bytes) => File.fromRawPath(bytes);
Related