Calling `listUsers` throws "Cannot be converted to a deep immutable object: Instance of 'GoogleCloudIdentitytoolkitV1ProviderUserInfo’"
Running under Windows.
The class definition for GoogleCloudIdentitytoolkitV1ProviderUserInfo cannot be found in firebase_admin. Instead it can be found in a dependency: https://github.com/invertase/dart_firebase_apis/blob/541a555ac378f7fadfdd404f5de04e6898da9523/generated/firebaseapis/lib/identitytoolkit/v1.dart#L3996
Seems like firebase_admin is unexpectedly getting this class rather than raw json data for deserialization.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument (value): Cannot be converted to a deep immutable object: Instance of 'GoogleCloudIdentitytoolkitV1ProviderUserInfo'
#0 toDeepImmutable
deep_immutable.dart:90
#1 new _DeepImmutableList.<anonymous closure>
deep_immutable.dart:123
#2 MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#3 ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#4 new _List._ofEfficientLengthIterable (dart:core-patch/array.dart:162:27)
#5 new _List.of (dart:core-patch/array.dart:127:20)
#6 new List.of (dart:core-patch/array_patch.dart:49:20)
#7 new List.from (dart:core-patch/array_patch.dart:33:19)
#8 new List.unmodifiable (dart:core-patch/array_patch.dart:67:24)
#9 new _DeepImmutableList
deep_immutable.dart:122
#10 toDeepImmutable
deep_immutable.dart:84
#11 new _DeepImmutableMap.<anonymous closure>
deep_immutable.dart:115
#12 MapBase.map (dart:collection/maps.dart:82:28)
#13 new _DeepImmutableMap
deep_immutable.dart:114
#14 toDeepImmutable
deep_immutable.dart:88
#15 new _SnapshotImpl
snapshot.dart:254
#16 _SnapshotImpl.set
snapshot.dart:362
#17 new UnmodifiableSnapshotView.fromJson
snapshot_view.dart:77
#18 new UserRecord.fromJson
user_record.dart:136
#19 AuthRequestHandler.downloadAccount.<anonymous closure>
auth_api_request.dart:93
#20 MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#21 ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#22 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#23 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#24 new List.of (dart:core-patch/array_patch.dart:47:28)
#25 ListIterable.toList (dart:_internal/iterable.dart:214:7)
#26 AuthRequestHandler.downloadAccount
auth_api_request.dart:94
<asynchronous suspension>
#27 Auth.listUsers
auth.dart:56
<asynchronous suspension>
I think I've found the root cause, and it's an incomplete implementation of GoogleCloudIdentitytoolkitV1UserInfo.toJson. I have filed an issue in the library.
https://github.com/invertase/dart_firebase_apis/issues/6
Turns out that this is by design. The workaround would be for firebase_admin to replace the .toJson() call with: jsonDecode(jsonEncode(u))
This is of course less efficient, but at least it will be "correct".
Context: dart_firebase_apis is based on googleapis.dart. https://github.com/google/googleapis.dart/issues/438
running into this issue to in version 0.3.0-dev4