RootSoft / algorand-dart

Unofficial community SDK to interact with the Algorand network, for Dart & Flutter
MIT License
36 stars 16 forks source link

Error trying to export a signed txn on flutter web #18

Closed 2i2i closed 2 years ago

2i2i commented 2 years ago

I get the following error running: await lockALGOTxnSigned.export('/path_to_a_folder/lockALGOTxnSigned.stxn'); after final lockALGOTxnSigned = await lockALGOTxn.sign(account);

The error might be because I am on flutter web and maybe dart:io does not work in web apps.

What is also strange that the error mentions templates/split.dart (http://localhost:49154/packages/algorand_dart/src/templates/split.dart.lib.js:5906:38). Why is there any connection to this file?

Error: Unsupported operation: _Namespace at Object.throw_ [as throw] (http://localhost:49154/dart_sdk.js:5061:11) at Function.get _namespacePointer [as _namespacePointer] (http://localhost:49154/dart_sdk.js:53920:17) at Function._namespacePointer (http://localhost:49154/dart_sdk.js:51823:28) at Function._dispatchWithNamespace (http://localhost:49154/dart_sdk.js:51826:31) at io._File.new.open (http://localhost:49154/dart_sdk.js:51941:23) at io._File.new.writeAsBytes (http://localhost:49154/dart_sdk.js:52155:19) at signed_transaction_model.SignedTransaction.new.$export (http://localhost:49154/packages/algorand_dart/src/templates/split.dart.lib.js:5906:38) at $export.next (<anonymous>) at runBody (http://localhost:49154/dart_sdk.js:38659:34) at Object._async [as async] (http://localhost:49154/dart_sdk.js:38690:7) at signed_transaction_model.SignedTransaction.new.export (http://localhost:49154/packages/algorand_dart/src/templates/split.dart.lib.js:5904:20) at algorand_service.AlgorandService.new._lockASA (http://localhost:49154/packages/app_2i2i/app/home/models/bid.dart.lib.js:872:39) at _lockASA.next (<anonymous>) at http://localhost:49154/dart_sdk.js:38640:33 at _RootZone.runUnary (http://localhost:49154/dart_sdk.js:38511:59) at _FutureListener.thenAwait.handleValue (http://localhost:49154/dart_sdk.js:33713:29) at handleValueCallback (http://localhost:49154/dart_sdk.js:34265:49) at Function._propagateToListeners (http://localhost:49154/dart_sdk.js:34303:17) at _Future.new.[_completeWithValue] (http://localhost:49154/dart_sdk.js:34151:23) at async._AsyncCallbackEntry.new.callback (http://localhost:49154/dart_sdk.js:34172:35) at Object._microtaskLoop (http://localhost:49154/dart_sdk.js:38778:13) at _startMicrotaskLoop (http://localhost:49154/dart_sdk.js:38784:13) at http://localhost:49154/dart_sdk.js:34519:9

RootSoft commented 2 years ago

What would the use case be? Do you want to download the file? You are not able to use dart:io in web apps.

You could do this: https://stackoverflow.com/a/63842948/798314