Flutter GRPC DTOS

Hello,
I’m testing GRPC with a flutter app on the ServiceStack server.
All classes are generated with:

x proto-dart https://url.to.our.appp -out lib

image

When building flutter project I’m getting these errors:

lib/services.pbgrpc.dart:5:1: Error: A library can’t opt out of null safety by default, when using sound null safety.
// @dart = 2.3
^^^^^^^^^^^^^^
lib/services.pb.dart:5:1: Error: A library can’t opt out of null safety by default, when using sound null safety.
// @dart = 2.3
^^^^^^^^^^^^^^
lib/services.pbenum.dart:5:1: Error: A library can’t opt out of null safety by default, when using sound null safety.
// @dart = 2.3
^^^^^^^^^^^^^^

That’s using dart’s grpc generator, we don’t do any of the code generation for gRPC.

I’ve upgraded to https://grpc.servicestack.net which x proto-dart uses to use the latest version of dart grpc plugin, which may help resolve the issue.

Issue was old x tool version on my side.

Unlikely, the tool doesn’t do any gRPC code-gen, it just calls the grpc.servicestack.net services which I just updated to use the latest grpc dart plugin.

1 Like