From bda678a349044eadf82f19e5eefd1bfa3400beed Mon Sep 17 00:00:00 2001 From: Levi Tan Ong Date: Fri, 16 Jun 2023 21:02:24 +0800 Subject: [PATCH] Workaround for serialization See: https://github.com/google/googleapis.dart/issues/438#issuecomment-1241237427 --- lib/src/auth/auth_api_request.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/auth/auth_api_request.dart b/lib/src/auth/auth_api_request.dart index 1292a89..ebe3cfc 100644 --- a/lib/src/auth/auth_api_request.dart +++ b/lib/src/auth/auth_api_request.dart @@ -90,7 +90,12 @@ class AuthRequestHandler { return ListUsersResult( users: response.users - ?.map((u) => UserRecord.fromJson(u.toJson())) + ?.map((u) { + // Temporary workaround. See: https://github.com/google/googleapis.dart/issues/438#issuecomment-1241237427 + // Should be replaced with a proper `u.toJson()` call once they come up with a fix. + final json = jsonDecode(jsonEncode(u)); + return UserRecord.fromJson(json); + }) .toList() ?? [], pageToken: response.nextPageToken);