universal_io icon indicating copy to clipboard operation
universal_io copied to clipboard

FormatException

Open naveenbharadwaj19 opened this issue 2 years ago • 14 comments

I have a Uint8List i want to create a filepath . But i'm getting Error: FormatException: Invalid UTF-8 byte (at offset 0)

Uint8List unit8List;
uio.File createFileFromUint8List(Uint8List uint8list) => uio.File.fromRawPath(uint8list);

Can someone tell me how to resolve this ?

naveenbharadwaj19 avatar Mar 01 '22 11:03 naveenbharadwaj19

Same problem here.

Error: FormatException: Unexpected extension byte (at offset 0)
    at Object.throw_ [as throw] ([http://localhost:59110/dart_sdk.js:5067:11]())
    at convert._Utf8Decoder.new.convertGeneral ([http://localhost:59110/dart_sdk.js:50774:19]())
    at convert._Utf8Decoder.new.convertSingle ([http://localhost:59110/dart_sdk.js:50751:19]())
    at Utf8Decoder.convert ([http://localhost:59110/dart_sdk.js:50616:67]())
    at Utf8Codec.decode ([http://localhost:59110/dart_sdk.js:50331:22]())
at Function.fromRawPath ([http://localhost:59110/packages/universal_io/src/io/sync_socket.dart.lib.js:3600:41]())
at createFileFromUint8List ([http://localhost:59110/packages/administrator/presentation/widgets/ad_template/ad_template_view.dart.lib.js:713:43]())
at ad_template_view._AdTemplateState.new.<anonymous> ([http://localhost:59110/packages/administrator/presentation/widgets/ad_template/ad_template_view.dart.lib.js:716:34]())
    at Generator.next (<anonymous>)
    at [http://localhost:59110/dart_sdk.js:40571:33]()
    at _RootZone.runUnary ([http://localhost:59110/dart_sdk.js:40441:59]())
    at _FutureListener.thenAwait.handleValue ([http://localhost:59110/dart_sdk.js:35363:29]())
    at handleValueCallback ([http://localhost:59110/dart_sdk.js:35931:49]())
    at Function._propagateToListeners ([http://localhost:59110/dart_sdk.js:35969:17]())
    at async._AsyncCallbackEntry.new.callback ([http://localhost:59110/dart_sdk.js:35698:27]())
    at Object._microtaskLoop ([http://localhost:59110/dart_sdk.js:40708:13]())
    at _startMicrotaskLoop ([http://localhost:59110/dart_sdk.js:40714:13]())
    at [http://localhost:59110/dart_sdk.js:36191:9]()

blackbeario avatar Mar 04 '22 19:03 blackbeario

the same , any solution ?

YouSour avatar Apr 22 '22 03:04 YouSour

Same here problem for me too.

tanjunior avatar May 11 '22 03:05 tanjunior

Same here. Any alternative to convert Uint8List to File on web?

aquilarafa avatar May 19 '22 11:05 aquilarafa

solved by this package if you want to convert File to Uint8list https://pub.dev/packages/image_picker

YouSour avatar May 20 '22 02:05 YouSour

solved by this package if you want to convert File to Uint8list https://pub.dev/packages/image_picker

The issue is to convert Uint8List to web representation of File

aquilarafa avatar May 20 '22 11:05 aquilarafa

@aquilarafa haha, i'm confused, my bad, i think you guy should check source code this package maybe it can help https://pub.dev/packages/file_saver

YouSour avatar May 21 '22 01:05 YouSour

can i ask what are you guy doing ? why convert Uint8list to file ?

YouSour avatar May 21 '22 01:05 YouSour

can i ask what are you guy doing ? why convert Uint8list to file ?

I'm using a package that expects a File (on web using universal_io package) but I only have the image Uint8list.

aquilarafa avatar May 21 '22 01:05 aquilarafa

@aquilarafa which package ?

YouSour avatar May 21 '22 06:05 YouSour

@aquilarafa which package ?

Sendbird flutter sdk

aquilarafa avatar May 21 '22 13:05 aquilarafa

@aquilarafa what's the end of your goal ?

YouSour avatar May 22 '22 03:05 YouSour

Facing same issue

Bharathh-Raj avatar Nov 29 '22 11:11 Bharathh-Raj

Same here

triay0 avatar Dec 28 '22 15:12 triay0