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