简体   繁体   中英

Flutter Web How to Convert Uint8List to File

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

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM