flutter web throw Error Assertion failed: "call initWeb() before initSession" - flutter

I got this error on Google Console after I released my flutter web app, and some of my methods don't work as well as they do in the Android version.
errors.dart:251 Uncaught (in promise) Error: Assertion failed: "call initWeb() before initSession"
at Object.throw_ [as throw] (errors.dart:251:49)
at flutter_branch_sdk_web.FlutterBranchSdk.__.initSession (flutter_branch_sdk_web.dart:169:7)
at FlutterBranchSdk.initSession (flutter_branch_sdk_plugin.dart:49:22)
at order_screen._OrderScreenState.new.listenDynamicLinks (order_screen.dart:63:57)
at listenDynamicLinks.next (<anonymous>)
at runBody (async_patch.dart:84:54)
at Object._async [as async] (async_patch.dart:123:5)
at order_screen._OrderScreenState.new.listenDynamicLinks (order_screen.dart:62:34)
at order_screen._OrderScreenState.new.initState (order_screen.dart:40:7)
at [_firstBuild] (framework.dart:4728:57)
at framework.StatefulElement.new.mount (framework.dart:4561:5)
at framework.SingleChildRenderObjectElement.new.inflateWidget (framework.dart:3631:13)
at framework.SingleChildRenderObjectElement.new.updateChild (framework.dart:3383:18)
at framework.SingleChildRenderObjectElement.new.mount (framework.dart:6123:14)
at framework.StatelessElement.new.inflateWidget (framework.dart:3631:13)
at framework.StatelessElement.new.updateChild (framework.dart:3383:18)
at framework.StatelessElement.new.performRebuild (framework.dart:4613:16)
at framework.StatelessElement.new.rebuild (framework.dart:4311:5)
at [_firstBuild] (framework.dart:4566:5)
at framework.StatelessElement.new.mount (framework.dart:4561:5)

Related

Why I get "Cannot read properties of undefined (reading 'default') while connecting with WalletConnectProvider"? in Flutter

I am getting the folling error when I want to connect to trustWallet or Metamask through walletconnect with flutter_web3 package.
Error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'default')
at WalletConnectProvider.fromRpc (wallet_connect.dart:86:7)
at web3_controller_notifier.Web3ControllerNotifier.new.connectWithWalletConnect (web3_controller_notifier.dart:73:52)
at connectWithWalletConnect.next (<anonymous>)
at runBody (async_patch.dart:84:54)
at Object._async [as async] (async_patch.dart:123:5)
at web3_controller_notifier.Web3ControllerNotifier.new.connectWithWalletConnect (web3_controller_notifier.dart:72:32)
at home_page.dart:86:51
at ink_well._InkResponseState.new.handleTap (ink_well.dart:1084:21)
at tap.TapGestureRecognizer.new.invokeCallback (recognizer.dart:282:24)
at tap.TapGestureRecognizer.new.handleTapUp (tap.dart:660:11)
at [_checkUp] (tap.dart:311:5)
at tap.TapGestureRecognizer.new.handlePrimaryPointer (tap.dart:244:7)
at tap.TapGestureRecognizer.new.handleEvent (recognizer.dart:647:9)
at [_dispatch] (pointer_router.dart:98:12)
at pointer_router.dart:143:9
at LinkedMap.new.forEach (linked_hash_map.dart:21:13)
at [_dispatchEventToRoutes] (pointer_router.dart:141:17)
at pointer_router.PointerRouter.new.route (pointer_router.dart:127:7)
at binding$5.WidgetsFlutterBinding.new.handleEvent (binding.dart:456:19)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:436:14)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:333:11)
at [_handlePointerEventImmediately] (binding.dart:391:7)
at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (binding.dart:354:5)
at [_flushPointerEventQueue] (binding.dart:311:7)
at [_handlePointerDataPacket] (binding.dart:292:7)
at Object.invoke1 (platform_dispatcher.dart:1221:13)
at _engine.EnginePlatformDispatcher.new.invokeOnPointerDataPacket (platform_dispatcher.dart:243:5)
at [_onPointerData] (pointer_binding.dart:167:39)
at pointer_binding.dart:778:20
at pointer_binding.dart:707:14
at loggedHandler (pointer_binding.dart:317:16)
at pointer_binding.dart:199:80
at Object._checkAndCall (operations.dart:367:37)
at Object.dcall (operations.dart:372:39)
at ret (js_patch.dart:415:11)
Called method:
void connectWithWalletConnect() async {
_walletConnectProvider = WalletConnectProvider.fromRpc(
{56: 'https://bsc-dataseed1.binance.org:443'},
chainId: 56,
network: 'Binance Smart Chain',
bridge: 'https://bridge.walletconnect.org',
);
await _walletConnectProvider.connect();
print('wallet connect ${_walletConnectProvider.walletMeta}');
if (_walletConnectProvider.connected) {
print(_walletConnectProvider.accounts.first);
}
}

How fix Error: Unexpected null value flutter web?

how solve this .
in moblie phone it works prefectly but when i build in web i have this error
Some helps please !
An Observatory debugger and profiler on Chrome is available at: http://127.0.0.1:60879/cssBXX81wfI=
Flutter Web Bootstrap: Auto
Token: null
====> API Call: /api/v1/config
Header: {Content-Type: application/json; charset=UTF-8, zoneId: null, X-localization: fr, Authorization: Bearer null}
Error: Unexpected null value.
at Object.throw_ [as throw] (http://localhost:60787/dart_sdk.js:5405:11)
at Object.nullCheck (http://localhost:60787/dart_sdk.js:5732:30)
at [_configureOverlay] (http://localhost:60787/packages/get/get_navigation/src/snackbar/snackbar_controller.dart.lib.js:3027:53)
at [_show] (http://localhost:60787/packages/get/get_navigation/src/snackbar/snackbar_controller.dart.lib.js:3190:30)
at Object._checkAndCall (http://localhost:60787/dart_sdk.js:5609:16)
at Object.callMethod (http://localhost:60787/dart_sdk.js:5652:17)
at Object.dsend (http://localhost:60787/dart_sdk.js:5655:17)
at get_queue.GetQueue.new._check$ (http://localhost:60787/packages/get/get_utils/src/queue/get_queue.dart.lib.js:91:65)
at _check$.next (<anonymous>)
at runBody (http://localhost:60787/dart_sdk.js:43083:34)
at Object._async [as async] (http://localhost:60787/dart_sdk.js:43114:7)
at [_check] (http://localhost:60787/packages/get/get_utils/src/queue/get_queue.dart.lib.js:86:20)
at get_queue.GetQueue.new.add (http://localhost:60787/packages/get/get_utils/src/queue/get_queue.dart.lib.js:79:19)
at snackbar_controller._SnackBarQueue.new._addJob (http://localhost:60787/packages/get/get_navigation/src/snackbar/snackbar_controller.dart.lib.js:3325:40)
at _addJob.next (<anonymous>)
at runBody (http://localhost:60787/dart_sdk.js:43083:34)
at Object._async [as async] (http://localhost:60787/dart_sdk.js:43114:7)
at [_addJob] (http://localhost:60787/packages/get/get_navigation/src/snackbar/snackbar_controller.dart.lib.js:3323:20)
at snackbar_controller.SnackbarController.new.show (http://localhost:60787/packages/get/get_navigation/src/snackbar/snackbar_controller.dart.lib.js:2996:76)
at Object.ExtensionSnackbar$124showSnackbar [as ExtensionSnackbar|showSnackbar]
(http://localhost:60787/packages/get/get_navigation/src/snackbar/snackbar_controller.dart.lib.js:12329:16)
at Object.showCustomSnackBar (http://localhost:60787/packages/efood_multivendor/view/base/custom_snackbar.dart.lib.js:38:61)
at ApiChecker.checkApi (http://localhost:60787/packages/efood_multivendor/data/repository/auth_repo.dart.lib.js:38045:25)
at splash_controller.SplashController.new.getConfigData (http://localhost:60787/packages/efood_multivendor/data/repository/auth_repo.dart.lib.js:38091:34)
at getConfigData.next (<anonymous>)
at http://localhost:60787/dart_sdk.js:43063:33
at _RootZone.runUnary (http://localhost:60787/dart_sdk.js:42919:58)
at _FutureListener.thenAwait.handleValue (http://localhost:60787/dart_sdk.js:37493:29)
at handleValueCallback (http://localhost:60787/dart_sdk.js:38088:49)
at _Future._propagateToListeners (http://localhost:60787/dart_sdk.js:38126:17)
at [_completeError] (http://localhost:60787/dart_sdk.js:37963:23)
at http://localhost:60787/dart_sdk.js:38200:38
at _RootZone.runBinary (http://localhost:60787/dart_sdk.js:42924:58)
at _FutureListener.then.handleError (http://localhost:60787/dart_sdk.js:37506:33)
at handleError (http://localhost:60787/dart_sdk.js:38104:51)
at _Future._propagateToListeners (http://localhost:60787/dart_sdk.js:38130:17)
at [_completeError] (http://localhost:60787/dart_sdk.js:37963:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:60787/dart_sdk.js:38015:31)
at Object._microtaskLoop (http://localhost:60787/dart_sdk.js:43223:13)
at _startMicrotaskLoop (http://localhost:60787/dart_sdk.js:43229:13)
at http://localhost:60787/dart_sdk.js:38359:9

Error during access Text Input (TextFormField) =>Bad state: Unsupported method call on the flutter/textinput channel: TextInput.setCaretRect

I'm using Chrome Browser as my Emulator to Run my Flutter Apps.
During accessing any TextInput (TextFormField) there's error like this:
Error: Bad state: Unsupported method call on the flutter/textinput channel: TextInput.setCaretRect
at Object.throw_ [as throw] (http://localhost:53880/dart_sdk.js:5033:11)
at _engine.TextEditingChannel.new.handleTextInput (http://localhost:53880/dart_sdk.js:170190:21)
at _engine.EnginePlatformDispatcher.__.[_sendPlatformMessage] (http://localhost:53880/dart_sdk.js:156913:39)
at _engine.EnginePlatformDispatcher.__.sendPlatformMessage (http://localhost:53880/dart_sdk.js:156780:33)
at _DefaultBinaryMessenger.[_sendPlatformMessage] (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:2110:38)
at _DefaultBinaryMessenger.send (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:2152:40)
at OptionalMethodChannel._invokeMethod (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:938:50)
at _invokeMethod.next (<anonymous>)
at runBody (http://localhost:53880/dart_sdk.js:37376:34)
at Object._async [as async] (http://localhost:53880/dart_sdk.js:37407:7)
at OptionalMethodChannel.[_invokeMethod] (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:936:20)
at OptionalMethodChannel.[_invokeMethod] (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:1059:34)
at OptionalMethodChannel.invokeMethod (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:1039:36)
at invokeMethod.next (<anonymous>)
at runBody (http://localhost:53880/dart_sdk.js:37376:34)
at Object._async [as async] (http://localhost:53880/dart_sdk.js:37407:7)
at OptionalMethodChannel.invokeMethod (http://localhost:53880/packages/flutter/src/services/system_channels.dart.lib.js:1038:20)
at text_input.TextInput.__.[_setCaretRect] (http://localhost:53880/packages/flutter/src/services/text_input.dart.lib.js:1324:22)
at text_input.TextInputConnection.__.setCaretRect (http://localhost:53880/packages/flutter/src/services/text_input.dart.lib.js:1089:52)
at editable_text.EditableTextState.new.[_updateCaretRectIfNeeded] (http://localhost:53880/packages/flutter/src/widgets/widget_span.dart.lib.js:43665:56)
at editable_text.EditableTextState.new.[_openInputConnection] (http://localhost:53880/packages/flutter/src/widgets/widget_span.dart.lib.js:43386:41)
at editable_text.EditableTextState.new.[_openOrCloseInputConnectionIfNeeded] (http://localhost:53880/packages/flutter/src/widgets/widget_span.dart.lib.js:43410:37)
at editable_text.EditableTextState.new.[_handleFocusChanged] (http://localhost:53880/packages/flutter/src/widgets/widget_span.dart.lib.js:43618:50)
at focus_manager.FocusNode.new.notifyListeners (http://localhost:53880/packages/flutter/src/foundation/change_notifier.dart.lib.js:106:41)
at focus_manager.FocusNode.new.[_notify] (http://localhost:53880/packages/flutter/src/widgets/widget_span.dart.lib.js:46499:12)
at focus_manager.FocusManager.new.[_applyFocusChange] (http://localhost:53880/packages/flutter/src/widgets/widget_span.dart.lib.js:47229:26)
at Object._microtaskLoop (http://localhost:53880/dart_sdk.js:37480:13)
at _startMicrotaskLoop (http://localhost:53880/dart_sdk.js:37486:13)
at http://localhost:53880/dart_sdk.js:33257:9
Any solution for this matter ?

Flutter web Http GET throws unwaited function

I'm running an HTTP get using flutter for the web and after connecting it stops running and directs me to the browser_client.dart file highlighting this function
unawaited(xhr.onLoad.first.then((_) {
var body = (xhr.response as ByteBuffer).asUint8List();
completer.complete(StreamedResponse(
ByteStream.fromBytes(body), xhr.status!,
contentLength: body.length,
request: request,
headers: xhr.responseHeaders,
reasonPhrase: xhr.statusText));
}));
then afterward shows this on the debug console
Error: error
at Object.throw_ [as throw] (http://localhost:53840/dart_sdk.js:5061:11)
at searchListing (http://localhost:53840/packages/maimo/app/data/services/api.dart.lib.js:33:19)
at searchListing.next (<anonymous>)
at http://localhost:53840/dart_sdk.js:38640:33
at _RootZone.runUnary (http://localhost:53840/dart_sdk.js:38511:59)
at _FutureListener.thenAwait.handleValue (http://localhost:53840/dart_sdk.js:33713:29)
at handleValueCallback (http://localhost:53840/dart_sdk.js:34265:49)

How to store Timestamp in firestore using flutter-web

I can't save a Timestamp object in Firebase Firestore using Flutter Web, with Android or iOS it works normally
Already tried:
FieldValue.serverTimestamp()
DateTime.now()
Timestamp.now()
Converting from MicrosecondsSinceEpoch()
My code:
baseOEC.set({'comentarios': FieldValue.arrayUnion([
{
'comentario': _comentarios.text,
// 'data': DateTime.now(), //this works for mobile
'data': FieldValue.serverTimestamp(),
'user': widget.user
}
])}, SetOptions(merge: true));
Error:
Error: [cloud_firestore/unknown] Invalid argument (dartObject): Could not convert: Instance of '_FieldValueServerTimestamp'
at Object.throw_ [as throw] (http://localhost:62147/dart_sdk.js:4354:11)
at document_reference_web.DocumentReferenceWeb.new.set (http://localhost:62147/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:615:21)
at set.next (<anonymous>)
at runBody (http://localhost:62147/dart_sdk.js:38020:34)
at Object._async [as async] (http://localhost:62147/dart_sdk.js:38051:7)
at document_reference_web.DocumentReferenceWeb.new.set (http://localhost:62147/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:610:20)
at cloud_firestore.DocumentReference.__.set (http://localhost:62147/packages/cloud_firestore/cloud_firestore.dart.lib.js:617:31)
at detalhes_oec_stream._DetalhesOecStreamState.new.<anonymous> (http://localhost:62147/packages/enterprise/screens/detalhes_oec_stream.dart.lib.js:3684:45)
at Generator.next (<anonymous>)
at runBody (http://localhost:62147/dart_sdk.js:38020:34)
at Object._async [as async] (http://localhost:62147/dart_sdk.js:38051:7)
at http://localhost:62147/packages/enterprise/screens/detalhes_oec_stream.dart.lib.js:3682:847
at ink_well._InkResponseState.new.[_handleTap] (http://localhost:62147/packages/flutter/src/material/icon_button.dart.lib.js:51103:42)
at tap.TapGestureRecognizer.new.invokeCallback (http://localhost:62147/packages/flutter/src/gestures/recognizer.dart.lib.js:189:18)
at tap.TapGestureRecognizer.new.handleTapUp (http://localhost:62147/packages/flutter/src/gestures/tap.dart.lib.js:395:40)
at tap.TapGestureRecognizer.new.[_checkUp] (http://localhost:62147/packages/flutter/src/gestures/tap.dart.lib.js:201:12)
at tap.TapGestureRecognizer.new.acceptGesture (http://localhost:62147/packages/flutter/src/gestures/tap.dart.lib.js:178:23)
at arena.GestureArenaManager.new.sweep (http://localhost:62147/packages/flutter/src/gestures/arena.dart.lib.js:208:31)
at binding$5.WidgetsFlutterBinding.new.handleEvent (http://localhost:62147/packages/flutter/src/gestures/binding.dart.lib.js:318:27)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:62147/packages/flutter/src/gestures/binding.dart.lib.js:297:24)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:62147/packages/flutter/src/rendering/layer.dart.lib.js:6087:13)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerEventImmediately] (http://localhost:62147/packages/flutter/src/gestures/binding.dart.lib.js:268:14)
at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (http://localhost:62147/packages/flutter/src/gestures/binding.dart.lib.js:241:43)
at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (http://localhost:62147/packages/flutter/src/gestures/binding.dart.lib.js:230:14)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (http://localhost:62147/packages/flutter/src/gestures/binding.dart.lib.js:220:65)
at Object.invoke1 (http://localhost:62147/dart_sdk.js:181069:7)
at _engine.EnginePlatformDispatcher.__.invokeOnPointerDataPacket (http://localhost:62147/dart_sdk.js:163043:15)
at _engine.PointerBinding.__.[_onPointerData] (http://localhost:62147/dart_sdk.js:163678:49)
at http://localhost:62147/dart_sdk.js:164111:26
at http://localhost:62147/dart_sdk.js:164070:16
at http://localhost:62147/dart_sdk.js:163778:11
As Andres S mentioned in the comments, I've updated the SDK, and also imported the "cloud_firestore_web" as dependency in pubspec.yaml.
This solution worked fine with DateTime.now()