Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Null safety support. #9

Open
ippo012 opened this issue Apr 21, 2021 · 15 comments
Open

Null safety support. #9

ippo012 opened this issue Apr 21, 2021 · 15 comments

Comments

@ippo012
Copy link

ippo012 commented Apr 21, 2021

I was wondering if you plan to support null-safety for this fusionauth-dart-client project?

@mooreds
Copy link
Contributor

mooreds commented Apr 21, 2021

Hmmm. Is this what you are talking about? https://dart.dev/null-safety/migration-guide

@ippo012
Copy link
Author

ippo012 commented Apr 25, 2021

Yes! I have tried but I get the following error.

Error: Cannot run with sound null safety, because the following dependencies
    don't support null safety:

     - package:fusionauth_dart_client

    For solutions, see https://dart.dev/go/unsound-null-safety
    ../../../../../.flutter/.pub-cache/git/fusionauth-dart-client-25d9ca4fd867c609fe91b6bc
    7fe1f40faf7969ce/lib/src/FusionAuthClient.dart:1484:41: Error: Method not found:
    'Map.fromJson'.
                (d) => Map<String, dynamic>.fromJson(d)))

@mooreds
Copy link
Contributor

mooreds commented Apr 26, 2021

Hiya,

It looks like we'd have to upgrade some major dependencies to get null safety:

Package Name       Current  Upgradable  Resolvable  Latest   

direct dependencies:
json_annotation    -        ✗3.1.1      ✓4.0.1      ✓4.0.1   

dev_dependencies: 
build_runner       -        ✗1.11.5     ✓2.0.1      ✓2.0.1   
json_serializable  -        ✗3.5.1      ✓4.1.1      ✓4.1.1   
pedantic           -        ✓1.11.0     ✓1.11.0     ✓1.11.0  
test               -        ✓1.16.5     ✓1.17.1     ✓1.17.1  

So we'd need to test this a bit.

I'm also unclear if we'd need to change what versions of dart we support (if we'd have to set the minimum sdk version to 2.12). Do you know if we'd have to do that?

@ippo012
Copy link
Author

ippo012 commented Apr 26, 2021

Thanks for confirming!

You're right! You'll need to upgrade the dependencies first.

And then we need to do some testing!

Since null safety stable is from dart 2.12.0, I think we need to make the minimum version 2.12.0.

If you want to migrate manually, it looks like you need to rewrite the dart version in pubspec.yml.

If you want to migrate automatically using dart migrate
When migrating automatically, the dart version of pubspec.yml seems to be rewritten automatically.

I hope this is helpful.

@ippo012
Copy link
Author

ippo012 commented May 10, 2021

Is there any developments?
Thank you

@mooreds
Copy link
Contributor

mooreds commented May 10, 2021

Thanks for bumping this. No developments right now. We've focused on getting a few core feature releases out the door and that's taken most of the team's time.

Happy to review a PR, however, and I'd like to take a look at this in the next few weeks.

@voidmain
Copy link
Member

I'd like to understand if this is backwards compatible or not. Based on our pubspec file, I think we are requiring Dart 2.7 or newer. However, we could potentially support 2.0 or newer to provide support to developers using older versions.

If this change would require us to bump out version to 2.12 (if null safety is not backwards compatible), then it might be better to create a new client library called fusionauth-dart-nullsafe-client.

@plavunov
Copy link

A new nullsafe library seems to be the optimal choice. Even with dependency overrides, I can't get this package to run

@mooreds
Copy link
Contributor

mooreds commented May 20, 2021

@plavunov what version of dart are you using? Just to be clear, are you saying this library doesn't work in a recent version of dart?

@plavunov
Copy link

plavunov commented May 21, 2021 via email

@mooreds
Copy link
Contributor

mooreds commented May 21, 2021

Thank you, that's very helpful. Glad you were able to move forward with the direct REST calls; they're not as nice as the client libraries, but are always available.

Sounds like we need to plan to deprecate this library and create a new one that has null safe dependencies and is usable with the current version of dart.

@bossbeagle1509
Copy link

Yes please ! That would be fantastic !

@mooreds
Copy link
Contributor

mooreds commented Jan 5, 2022

Looks like this was actually updated a few months ago to 2.12. Can you take a look @bossbeagle1509 at the latest version and see if it addresses your issues?

@bossbeagle1509
Copy link

Oh epik ! I wasn't aware that it had been ported to null safety :) Thank you for bringing this to my notice ! We'll make the transition soon :)

@mooreds
Copy link
Contributor

mooreds commented Jan 6, 2022

@bossbeagle1509 Please take it for a test drive!

I think that the libs and the version have been updated, but haven't yet built an app with the latest version of the client lib and am new to dart.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants