anthonychwong / auth0-flutter-web

Wrapper of Auth0 SPA SDK for Flutter Web
BSD 3-Clause "New" or "Revised" License
8 stars 11 forks source link

Null safety #8

Open venkatd opened 3 years ago

venkatd commented 3 years ago

All of our dependencies are null safe so it would be nice for this to be null safe as well. Any chance we could sponsor you for a few hours to upgrade it to null safety?

anthonychwong commented 3 years ago

Sure, I can do it sometime next week, but my buy me a coffee book page seems broken for some reason. Will also fix that soon.

venkatd commented 3 years ago

Turns out we won't end up using auth0 for our app, but happy to buy you a book anyway. Let me know once it's fixed :)

anthonychwong commented 3 years ago

Hey, was studying Type Script for this, and busy for some other things as well. Now here are some update on this.

anthonychwong commented 3 years ago

It is now published here 0.0.1-alpha.6.

anthonychwong commented 3 years ago

(mis-clicked)

vanlooverenkoen commented 3 years ago

Not working on our project We get this with

auth0_flutter_web: ^0.0.1-alpha.6

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

 - package:auth0_flutter_web

For solutions, see https://dart.dev/go/unsound-null-safety
Unhandled exception:
Bad state: Unsupported Null Safety mode NonNullableByDefaultCompiledMode.Invalid, in null.
#0      ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:442:9)
#1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:146:33)
#2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:638:47)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:549:9)
<asynchronous suspension>
#4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1119:11)
<asynchronous suspension>
Finished with error: the Dart compiler exited unexpectedly.
Failed to compile application.

This is because the plugin does not support strong-mode

strong-mode: implicit-casts: false implicit-dynamic: false

anthonychwong commented 2 years ago

@vanlooverenkoen For some reason pud.dev really like the old package 0.0.1-alpha.20210224 a lot and treat this as the latest one, even when checking null safety.

I tried to pin to 0.0.1-alpha.6 (by removing the prefixed head ^), than my testing project compiles. Please let me know if this works for you.

vanlooverenkoen commented 2 years ago

It has nothing to do with the versions. The plugin does not support strongmode

Add the following to your analyis_options.yml

implicit-casts: false
implicit-dynamic: false

And you will not be able to compile your project.

anthonychwong commented 2 years ago

@vanlooverenkoen In my testing project, those are enabled as well. and the output looks well.

> flutter clean
Deleting .dart_tool...                                              21ms
Deleting .packages...                                                3ms

> flutter pub get
Running "flutter pub get" in auth0_flutter_web_testing...        1,253ms

> dart analyze
Analyzing auth0_flutter_web_testing... 7.5s
No issues found!

> flutter build web

💪 Building with sound null safety 💪

Compiling lib/main.dart for the Web...                             47.6s

The testing project is in here