I am working on a Flutter project.
I need to create a web app from the project.
The web app is launched at https://appcapenergy.com/web
Today I have made an update from the project, I have published the iOS app and the Android app to the stores, Apple App Store and Google Play.
Now I have build the web app, but it is not working.
Launching the web app locally or in the server it only shows a blank screen.
Here you have the browser inspection Console log:
Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://localhost:61121/') with script ('http://localhost:61121/firebase-messaging-sw.js'): A bad HTTP response code (404) was received when fetching the script.
main.dart.js:72 Uncaught TypeError: Cannot read properties of null (reading 'removeChild')
at HTMLDocument.<anonymous> (main.dart.js:72:22)
at client.js:24535:40
at _wrapJsFunctionForAsync_closure.$protected (client.js:3471:15)
at _wrapJsFunctionForAsync_closure.call$2 (client.js:11541:12)
at _awaitOnObject_closure.call$1 (client.js:11529:32)
at StaticClosure._rootRunUnary (client.js:3833:18)
at _CustomZone.runUnary$2$2 (client.js:12941:39)
at _Future__propagateToListeners_handleValueCallback.call$0 (client.js:11973:51)
at Object._Future__propagateToListeners (client.js:3613:93)
at _Future._completeWithValue$1 (client.js:11799:9)
at _AsyncAwaitCompleter.complete$1 (client.js:11512:14)
at Object._asyncReturn (client.js:3443:17)
at client.js:8734:24
at _wrapJsFunctionForAsync_closure.$protected (client.js:3471:15)
at _wrapJsFunctionForAsync_closure.call$2 (client.js:11541:12)
at _awaitOnObject_closure.call$1 (client.js:11529:32)
at StaticClosure._rootRunUnary (client.js:3833:18)
at _CustomZone.runUnary$2$2 (client.js:12941:39)
at _Future__propagateToListeners_handleValueCallback.call$0 (client.js:11973:51)
at Object._Future__propagateToListeners (client.js:3613:93)
at _Future._completeWithValue$1 (client.js:11799:9)
at _AsyncAwaitCompleter.complete$1 (client.js:11512:14)
at Object._asyncReturn (client.js:3443:17)
at client.js:25007:24
at _wrapJsFunctionForAsync_closure.$protected (client.js:3471:15)
at _wrapJsFunctionForAsync_closure.call$2 (client.js:11541:12)
at _awaitOnObject_closure.call$1 (client.js:11529:32)
at StaticClosure._rootRunUnary (client.js:3833:18)
at _CustomZone.runUnary$2$2 (client.js:12941:39)
at _Future__propagateToListeners_handleValueCallback.call$0 (client.js:11973:51)
at Object._Future__propagateToListeners (client.js:3613:93)
at _Future._completeWithValue$1 (client.js:11799:9)
at _AsyncAwaitCompleter.complete$1 (client.js:11512:14)
at Object._asyncReturn (client.js:3443:17)
at client.js:24984:24
at _wrapJsFunctionForAsync_closure.$protected (client.js:3471:15)
at _wrapJsFunctionForAsync_closure.call$2 (client.js:11541:12)
at _awaitOnObject_closure.call$1 (client.js:11529:32)
at StaticClosure._rootRunUnary (client.js:3833:18)
at _CustomZone.runUnary$2$2 (client.js:12941:39)
at _Future__propagateToListeners_handleValueCallback.call$0 (client.js:11973:51)
at Object._Future__propagateToListeners (client.js:3613:93)
at _Future._completeWithValue$1 (client.js:11799:9)
at _Future__asyncCompleteWithValue_closure.call$0 (client.js:11901:18)
at StaticClosure._rootRun (client.js:3818:16)
at _CustomZone.run$1$1 (client.js:12933:39)
at _CustomZone.runGuarded$1 (client.js:12876:14)
at _CustomZone_bindCallbackGuarded_closure.call$0 (client.js:13071:25)
at Object._microtaskLoop (client.js:3677:24)
at StaticClosure._startMicrotaskLoop (client.js:3683:11)
at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1 (client.js:11417:9)
at invokeClosure (client.js:1277:26)
at MutationObserver.<anonymous> (client.js:1296:18)
This app is linked to the debug service: ws://127.0.0.1:61185/AiCArEXaM00=/ws
js_primitives.dart:30 Flutter Web Bootstrap: Programmatic
errors.dart:266 Uncaught (in promise) Error: Unsupported operation: Platform._operatingSystem
at Object.throw_ [as throw] (errors.dart:266:49)
at _Platform._operatingSystem (io_patch.dart:244:5)
at get operatingSystem [as operatingSystem] (platform_impl.dart:56:40)
at get _operatingSystem (platform.dart:64:45)
at desc.get [as _operatingSystem] (operations.dart:839:8)
at get isIOS (platform.dart:153:47)
at desc.get [as isIOS] (operations.dart:839:8)
at MethodChannelStripeFactory.create (method_channel_stripe.dart:479:33)
at get _instance (stripe_platform_interface.dart:12:72)
at desc.get [as _instance] (operations.dart:839:8)
at get instance [as instance] (stripe_platform_interface.dart:17:41)
at get _platform [as _platform] (stripe.dart:535:35)
at stripe.Stripe.__.markNeedsSettings (stripe.dart:542:20)
at set publishableKey [as publishableKey] (stripe.dart:24:14)
at main$ (main.dart:38:10)
at main$.next (<anonymous>)
at runBody (async_patch.dart:84:54)
at Object._async [as async] (async_patch.dart:123:5)
at main$ (main.dart:34:5)
at web_entrypoint.dart:24:31
at Object._checkAndCall (operations.dart:334:14)
at Object.dcall (operations.dart:339:39)
at initialization.dart:77:15
at Generator.next (<anonymous>)
at async_patch.dart:45:50
at _RootZone.runUnary (zone.dart:1653:54)
at _FutureListener.thenAwait.handleValue (future_impl.dart:147:18)
at handleValueCallback (future_impl.dart:766:44)
at _Future._propagateToListeners (future_impl.dart:795:13)
at [_completeWithValue] (future_impl.dart:566:5)
at async._AsyncCallbackEntry.new.callback (future_impl.dart:639:7)
at Object._microtaskLoop (schedule_microtask.dart:40:11)
at _startMicrotaskLoop (schedule_microtask.dart:49:5)
at async_patch.dart:166:15
throw_ # errors.dart:266
_operatingSystem # io_patch.dart:244
get operatingSystem # platform_impl.dart:56
get _operatingSystem # platform.dart:64
desc.get # operations.dart:839
get isIOS # platform.dart:153
desc.get # operations.dart:839
create # method_channel_stripe.dart:479
get _instance # stripe_platform_interface.dart:12
desc.get # operations.dart:839
get instance # stripe_platform_interface.dart:17
get _platform # stripe.dart:535
markNeedsSettings # stripe.dart:542
set publishableKey # stripe.dart:24
main$ # main.dart:38
runBody # async_patch.dart:84
_async # async_patch.dart:123
main$ # main.dart:34
(anonymous) # web_entrypoint.dart:24
_checkAndCall # operations.dart:334
dcall # operations.dart:339
(anonymous) # initialization.dart:77
(anonymous) # async_patch.dart:45
runUnary # zone.dart:1653
handleValue # future_impl.dart:147
handleValueCallback # future_impl.dart:766
_propagateToListeners # future_impl.dart:795
[_completeWithValue] # future_impl.dart:566
(anonymous) # future_impl.dart:639
_microtaskLoop # schedule_microtask.dart:40
_startMicrotaskLoop # schedule_microtask.dart:49
(anonymous) # async_patch.dart:166
Promise.then (async)
_scheduleImmediateWithPromise # async_patch.dart:164
_scheduleImmediate # async_patch.dart:136
_scheduleAsyncCallback # schedule_microtask.dart:69
_rootScheduleMicrotask # zone.dart:1458
scheduleMicrotask # zone.dart:1673
[_asyncCompleteWithValue] # future_impl.dart:638
[_asyncComplete] # future_impl.dart:598
runBody # async_patch.dart:108
_async # async_patch.dart:123
initializeEngineUi # initialization.dart:224
(anonymous) # initialization.dart:75
runBody # async_patch.dart:84
_async # async_patch.dart:123
(anonymous) # initialization.dart:71
_checkAndCall # operations.dart:334
callMethod # operations.dart:398
dsend # operations.dart:402
(anonymous) # app_bootstrap.dart:72
runBody # async_patch.dart:84
_async # async_patch.dart:123
(anonymous) # app_bootstrap.dart:70
_checkAndCall # operations.dart:334
dcall # operations.dart:339
ret # js_patch.dart:413
(anonymous) # app_bootstrap.dart:68
_checkAndCall # operations.dart:334
dcall # operations.dart:339
ret # js_patch.dart:413
(anonymous) # web:53
I need your help to try to solve the issue
Please do this!
I run this in the console of my navigator (Chrome), and no error message anymore :
navigator.serviceWorker.getRegistrations().then(function(registrations) { for(let registration of registrations) { registration.unregister() } })
and check this link
https://www.fluttercampus.com/guide/163/how-to-fix-blank-white-page-from-hosted-flutter-web-app/#:~:text=html%20with%20code%20editor%2C%20you,attribute%20to%20solve%20this%20problem
Related
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);
}
}
I am trying the getRegionInfoFromPhoneNumber function from the intl_phone_number_input Flutter Package (0.7.1 - latest one)
It was functioning before but I was testing it today and it gave this error:
//CODE FROM THEIR PACKAGE
String phoneNumber = '+234 500 500 5005';
PhoneNumber number = await PhoneNumber.getRegionInfoFromPhoneNumber(phoneNumber);
//ERROR
TypeError: Cannot read properties of undefined (reading 'PhoneNumberUtil')
at getRegionInfo (http://localhost:51866/packages/libphonenumber_web/src/libphonenumber_plugin.dart.lib.js:56:58)
at getRegionInfo.next (<anonymous>)
at runBody (http://localhost:51866/dart_sdk.js:40660:34)
at Object._async [as async] (http://localhost:51866/dart_sdk.js:40691:7)
at libphonenumber_plugin.LibPhoneNumberPlugin.new.getRegionInfo (http://localhost:51866/packages/libphonenumber_web/src/libphonenumber_plugin.dart.lib.js:55:20)
at getRegionInfo (http://localhost:51866/packages/libphonenumber_plugin/src/phone_number_util.dart.lib.js:49:75)
at getRegionInfo.next (<anonymous>)
at runBody (http://localhost:51866/dart_sdk.js:40660:34)
at Object._async [as async] (http://localhost:51866/dart_sdk.js:40691:7)
at PhoneNumberUtil.getRegionInfo (http://localhost:51866/packages/libphonenumber_plugin/src/phone_number_util.dart.lib.js:48:20)
at getRegionInfo (http://localhost:51866/packages/intl_phone_number_input/src/utils/phone_number/phone_number_util.dart.lib.js:158:65)
at getRegionInfo.next (<anonymous>)
at runBody (http://localhost:51866/dart_sdk.js:40660:34)
at Object._async [as async] (http://localhost:51866/dart_sdk.js:40691:7)
at PhoneNumberUtil.getRegionInfo (http://localhost:51866/packages/intl_phone_number_input/src/utils/phone_number/phone_number_util.dart.lib.js:157:20)
at getRegionInfoFromPhoneNumber (http://localhost:51866/packages/intl_phone_number_input/src/utils/phone_number/phone_number_util.dart.lib.js:476:68)
at getRegionInfoFromPhoneNumber.next (<anonymous>)
at runBody (http://localhost:51866/dart_sdk.js:40660:34)
at Object._async [as async] (http://localhost:51866/dart_sdk.js:40691:7)
at PhoneNumber.getRegionInfoFromPhoneNumber (http://localhost:51866/packages/intl_phone_number_input/src/utils/phone_number/phone_number_util.dart.lib.js:474:20)
at upload_data_form._UploadDataFormState.new.<anonymous> (http://localhost:51866/packages/excelit/widgets/remember_me.dart.lib.js:13587:84)
at Generator.next (<anonymous>)
at runBody (http://localhost:51866/dart_sdk.js:40660:34)
at Object._async [as async] (http://localhost:51866/dart_sdk.js:40691:7)
at http://localhost:51866/packages/excelit/widgets/remember_me.dart.lib.js:13531:218
at _RootZone.runUnary (http://localhost:51866/dart_sdk.js:40511:59)
at _FutureListener.then.handleValue (http://localhost:51866/dart_sdk.js:35438:29)
at handleValueCallback (http://localhost:51866/dart_sdk.js:35999:49)
at _Future._propagateToListeners (http://localhost:51866/dart_sdk.js:36037:17)
at [_completeWithValue] (http://localhost:51866/dart_sdk.js:35872:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:51866/dart_sdk.js:35906:35)
at Object._microtaskLoop (http://localhost:51866/dart_sdk.js:40778:13)
at _startMicrotaskLoop (http://localhost:51866/dart_sdk.js:40784:13)
at http://localhost:51866/dart_sdk.js:36261:9
I tried on several valid phone numbers
My code reads an Excel File row by row and creates a Client Object (name, address... phone_num)
//TEMPLIST: [Client A, Mr. Ahmad, ahmad#mindit.com, Lebanon, Beirut, Badaro, 96181816583, -, -]
//phonenumber returned by the string manipulation below is +96181816583 which should be valid
PhoneNumber number1 = await PhoneNumber
.getRegionInfoFromPhoneNumber((tempList
.elementAt(6)
.substring(0, 1) !=
'+')
? '+${tempList.elementAt(6).replaceAll(' ', '')}'
: tempList
.elementAt(6)
.replaceAll(' ', ''),)
.onError((error, stackTrace) {
failureSnackBar(context,
'Invalid or missing phone_num in ${file.name} row ${row.elementAt(0)!.rowIndex + 1}');
Navigator.pop(context);
breakLoop = true;
return PhoneNumber();
});
This same Excel file worked before and I could get the PhoneNumbers right but now it isn't.
And even if i specify the isoCode it still gives the same error.
Any help would be appreciated!
I forgot to answer this but I forgot to add these in the index.html
<script src="assets/packages/libphonenumber_plugin/js/libphonenumber.js"></script>
<script src="assets/packages/libphonenumber_plugin/js/stringbuffer.js"></script>
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
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 ?
I am just making an object of Google protocol buffer which I named OrganisasationUiPb and organisationUipb contain another protocol buffer message EntityUipb
my code
OrganisationUiPb uipb = new OrganisationUiPb();
uipb.dbInfo.id = "add";
uipb.name.canonicalName = "add";
print(uipb);
OrganisationUiPb
message OrganisationUiPb {
EntityUiPb dbInfo = 1;
NameUiPb name = 2;
TimeUiPb time = 3;
string orgCode = 4;
}
EntityUipb
message EntityUiPb {
string id = 1;
int32 version = 2;
StatusEnum lifeTime = 3;
LocaleUiPb locale = 4;
}
when I make an object of OrganisationUipb and start assign values I got this error in cosole
Error: Unsupported operation: Attempted to change a read-only message (EntityUiPb)
at Object.throw_ [as throw] (http://localhost:49885/dart_sdk.js:4463:11)
at Object.defaultFrozenMessageModificationHandler (http://localhost:49885/packages/protobuf/src/protobuf/type_registry.dart.lib.js:5888:15)
at protobuf._FieldSet.new.[_ensureWritable] (http://localhost:49885/packages/protobuf/src/protobuf/type_registry.dart.lib.js:2551:50)
at protobuf._FieldSet.new.[_validateField] (http://localhost:49885/packages/protobuf/src/protobuf/type_registry.dart.lib.js:3007:28)
at protobuf._FieldSet.new.[_$check] (http://localhost:49885/packages/protobuf/src/protobuf/type_registry.dart.lib.js:2800:27)
at protobuf._FieldSet.new.[_$set] (http://localhost:49885/packages/protobuf/src/protobuf/type_registry.dart.lib.js:2783:35)
at entityUiPb$46pb.EntityUiPb.__.$_setString (http://localhost:49885/packages/protobuf/src/protobuf/type_registry.dart.lib.js:3956:36)
at entityUiPb$46pb.EntityUiPb.__.set id [as id] (http://localhost:49885/packages/StudenceWebOrMObileUI/Protobuff/entityUiPb.pb.dart.lib.js:100:12)
at Object.main$ [as main] (http://localhost:49885/packages/StudenceWebOrMObileUI/main.dart.lib.js:491:20)
at main$ (http://localhost:49885/web_entrypoint.dart.lib.js:14:12)
at main$.next (<anonymous>)
at http://localhost:49885/dart_sdk.js:37175:33
at _RootZone.runUnary (http://localhost:49885/dart_sdk.js:37029:58)
at _FutureListener.thenAwait.handleValue (http://localhost:49885/dart_sdk.js:32116:29)
at handleValueCallback (http://localhost:49885/dart_sdk.js:32663:49)
at Function._propagateToListeners (http://localhost:49885/dart_sdk.js:32701:17)
at async._AsyncCallbackEntry.new.callback (http://localhost:49885/dart_sdk.js:32427:27)
at Object._microtaskLoop (http://localhost:49885/dart_sdk.js:37290:13)
at _startMicrotaskLoop (http://localhost:49885/dart_sdk.js:37296:13)
at http://localhost:49885/dart_sdk.js:32918:9
and on UI I got
errors.dart:165 Uncaught (in promise) Error: Unsupported operation: Attempted to change a read-only message (EntityUiPb)
at Object.throw_ [as throw] (errors.dart:214)
at Object.defaultFrozenMessageModificationHandler (field_set.dart:15)
at protobuf._FieldSet.new.[_ensureWritable] (field_set.dart:157)
at protobuf._FieldSet.new.[_validateField] (field_set.dart:794)
at protobuf._FieldSet.new.[_$check] (field_set.dart:512)
at protobuf._FieldSet.new.[_$set] (field_set.dart:493)
at entityUiPb$46pb.EntityUiPb.__.$_setString (generated_message.dart:456)
at entityUiPb$46pb.EntityUiPb.__.set id [as id] (entityUiPb.pb.dart:44)
at Object.main$ [as main] (main.dart:21)
at main$ (web_entrypoint.dart:9)
at main$.next (<anonymous>)
at async_patch.dart:45
at _RootZone.runUnary (zone.dart:1450)
at _FutureListener.thenAwait.handleValue (future_impl.dart:143)
at handleValueCallback (future_impl.dart:696)
at Function._propagateToListeners (future_impl.dart:725)
at async._AsyncCallbackEntry.new.callback (future_impl.dart:393)
at Object._microtaskLoop (schedule_microtask.dart:41)
at _startMicrotaskLoop (schedule_microtask.dart:50)
at async_patch.dart:166
please help me and provide solution of this so I can counter this problem
The reason for this is that the Dart protobuf implementation creates an immutable default value for the child objects of OrganisationUiPb so uipb.dbInfo is read-only from creation.
The workaround is to create the child object first, something like this:
EntityUiPb dbInfoTemp= new EntityUiPb();
dbInfoTemp.id = "add";
OrganisationUiPb uipb = new OrganisationUiPb()..dbInfo = dbInfoTemp;
...
print(uipb);
Mode discussion on the issue here:
https://github.com/dart-lang/protobuf/issues/305