currently generated Dart classes have non-nullable properties, and can’t be used with null-safety mode.
Is there a possibility to change this?
It’s on the TODO list, please file feature requests on UserVoice so we can keep track of it and let you know when it’s implemented: https://servicestack.uservoice.com
Thanks, but I can’t file feature request:
You’ve used all your votes and won’t be able to post a new idea, but you can still search and comment on existing ideas
I believe you can reclaim your points if you unvote or delete requests.
In the meantime you can vote for it here:
I just hit this issue and can see that there have been some commits in the last few days to fix it.
@mythz: Is it ready to use?
How can I update to a pre-release version of ServiceStack containing the fixes?
I’ve tried to follow the MyGet documentation but had no luck, I can’t seem to find a package listing section on the MyGet website.
Trying to use
dotnet list package --outdated also did not work.
Do I need to compile ServiceStack from source to be able to use the latest improvements?
Yes it’s ready to use, you need to download the latest ServiceStack v5.11.1 on MyGet by clearing your NuGet cache and restoring:
$ nuget locals all -clear
Which will generate null safe DTOs that need to be used with v2+ of servicestack dart library:
dependencies: servicestack: ^2.0.0
I’m using updated packages and everything seems to be working.
I have one issue, but I am not sure is it related to ServiceStack or something in my Flutter project.
IHasResponseStatus interface is implemented on all my response DTO classes on server side in C#.
In Flutter project, ResponseStatus class is not imported.
I have fixed issue with this hack:
import 'package:servicestack/servicestack.dart'; import 'package:servicestack/servicestack.dart' as ss;
And find-replace all instances of ResponseStatus with ss.ResponseStatus:
But I have to do that every time dtos are generated.
ResponseStatus definitely still exists since you’re able to reference it. Do you have a conflicting
ResponseStatus class defined in your project?
No, I have tried to find all declarations of ResponseStatus in intelliJ, and the only declaration is in client_dtos.dart:
So if you click on
ResponseStatus without the alias hack it doesn’t go anywhere? Can you post the actual error the Dart compiler is complaining about?
When I click on ResponseStatus it doesn’t go anywhere.
If I try to click on suggested action to import package, servicestack.dart is imported again:
I’m not able to repro this in a new flutter project after registering the v2 servicestack dependency:
then fetch my localhost App DTOs with:
$ x dart http://localhost:5000 -out lib
Which builds the DTOs referencing
ResponseStatus without errors:
Which I’m able to call from my Flutter Android App without issue.
I’m assuming it could be an IDE analysis issue instead of a broken build, can you Invalid Caches / Restart to see if it helps. If it’s still broken can build the project and report any build errors.