Hello,
occasionally I encounter errors in production when calling the api method on the Dart ServiceStack client for Flutter in version 3.0.0.
I haven’t been able to identify a pattern, but I have stack trace from Sentry logs:
_TypeError: type '_Map<String?, String?>' is not a subtype of type 'Map<String, String>?' in type cast
File "utils.dart", line 190, in createUri
File "client.dart", line 517, in JsonServiceClient.createRequest
File "client.dart", line 425, in JsonServiceClient.sendRequest
File "client.dart", line 219, in JsonServiceClient.fetch
File "client.dart", line 198, in JsonServiceClient.api
Example code I am using:
Future<List<ReportDto>> getReports() async {
final req = GetOpenReports(userId: ioc<AuthService>().userId.value);
final res = await client.api(req);
if (res.succeeded) {
final reports = (res.response?.results ?? []);
return reports;
} else {
showErrorDialog(res.errorMessage ?? 'An error occurred');
return [];
}
}
Any advice?