Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to nnbd #489

Merged
merged 26 commits into from
Mar 19, 2021
Merged

Migrate to nnbd #489

merged 26 commits into from
Mar 19, 2021

Conversation

nohli
Copy link
Contributor

@nohli nohli commented Mar 9, 2021

Closes #486

@Mayb3Nots
Copy link
Contributor

Hi @nohli do you need help with migrating the package? I can help if you need any.

@nohli
Copy link
Contributor Author

nohli commented Mar 12, 2021

@Mayb3Nots Packages fluter_audio_recorder and flutter_audio_query (in example app) are not null safe. If you could replace them with different packages, it would help a lot.

@Mayb3Nots
Copy link
Contributor

fluter_audio_recorder

I can try migrate those package to null safety ;)

@nohli
Copy link
Contributor Author

nohli commented Mar 12, 2021

The recorder already has an nnbd PR that you could review (but it only help us if it gets published to pub.dev).

@Mayb3Nots
Copy link
Contributor

Mayb3Nots commented Mar 12, 2021

For now we can use this while waiting for the owners of these packages to update.

flutter_audio_recorder:
  git: 
    url:https://github.com/fayeed/flutter_audio_recorder
    ref: fde3668469b65c059c806c53edd561e9908006ab

As for flutter_audio_query I will migrating the package myself.

@nohli
Copy link
Contributor Author

nohli commented Mar 12, 2021

Yeah. Since it's only the example app it should even be fine. So only the other package - migrating or replacing :)

Also, this package basically consists of three parts - web, example and lib. You can also work on web and/or example (example would be great) if you like? Sent you an invite for collaborating on the migration fork.

Probably best if you create a new branch 'migrate-example-app'?

@nohli
Copy link
Contributor Author

nohli commented Mar 14, 2021

@kalismeras61 where do the auto-generated libraries ../lib/generated/i18n.dart come from? They're not null safe.

@kalismeras61
Copy link
Collaborator

@kalismeras61 where do the auto-generated libraries ../lib/generated/i18n.dart come from? They're not null safe.

@Mayb3Nots did you start any migration yet?

i don't think it using anywhere, no idea but Florent created this with flutter_i18n package.

@nohli
Copy link
Contributor Author

nohli commented Mar 15, 2021

TODO After assets_audio_player_web is published, the dependency in pubspec.yaml needs to be changed from git to pub.dev in order to publish the main package.

The example app has two git dependencies (of PRs from null safety migration, one from Mayb3Nots 🎉), which should be fine for now.

Also, I declared it as a prerelease and not a stable 3.0.0 version. So much changed code better needs to be tested before making it the next stable.

FYI I've added the linter pedantic which further improved some parts of the code. This, and updated dependencies, will result in 20 more pub.dev points.

@nohli nohli marked this pull request as ready for review March 15, 2021 03:02
@Mayb3Nots
Copy link
Contributor

TODO After assets_audio_player_web is published, the dependency in pubspec.yaml needs to be changed from git to pub.dev in order to publish the main package.

The example app has two git dependencies (of PRs from null safety migration, one from Mayb3Nots 🎉), which should be fine for now.

Also, I declared it as a prerelease and not a stable 3.0.0 version. So much changed code better needs to be tested before making it the next stable.

FYI I've added the linter pedantic which further improved some parts of the code. This, and updated dependencies, will result in 20 more pub.dev points.

Thank you so much for your contribution. I am sorry I couldn't be of more use.

@venkata-reddy-dev
Copy link

venkata-reddy-dev commented Mar 18, 2021

Can you please merge this pull request ASAP and release null safety pre release version. so that people can use this changes in production

cc: @nohli , @kalismeras61

@nohli
Copy link
Contributor Author

nohli commented Mar 18, 2021

@RR-Reddy you can use it in production with

  assets_audio_player:
    git:
      url: https://github.com/nohli/Flutter-AssetsAudioPlayer
      ref: migrate-to-nnbd

On a side note, if you're not dependent on sound null safety right now, the well tested stable release would be safer at the moment.

@venkata-reddy-dev
Copy link

@nohli to make it work, we have to override web dependency as below. along with main dependency

dependency_overrides:
  assets_audio_player_web:
    git:
      url: https://github.com/nohli/Flutter-AssetsAudioPlayer
      path: assets_audio_player_web

@nohli
Copy link
Contributor Author

nohli commented Mar 18, 2021

@nohli to make it work, we have to override web dependency as below. along with main dependency


dependency_overrides:

  assets_audio_player_web:

    git:

      url: https://github.com/nohli/Flutter-AssetsAudioPlayer

      path: assets_audio_player_web

This doesn't look like it's using the nnbd-migrated branch though.

@nohli
Copy link
Contributor Author

nohli commented Mar 18, 2021

@kalismeras61 I've tested the package in my apps and it works well. So far no other reported issues.
In the last days, many packages were upgraded, which (for most users) makes this the only package that needs dependency_overrides.

Maybe it can be published to pub.dev (first assets_audio_player_web and then the main package with the updated assets_audio_player_web dependency)?

@kalismeras61
Copy link
Collaborator

kalismeras61 commented Mar 18, 2021

@nohli , thanks for the update. I am going to check on my side and will publish new version today.

@kalismeras61
Copy link
Collaborator

kalismeras61 commented Mar 18, 2021

@nohli did you test this for both plaform ? or some one did test for android and also ios as well ?

@nohli
Copy link
Contributor Author

nohli commented Mar 18, 2021

@kalismeras61 on both platforms, but let me test the example app on both platforms, too, just to make sure.

case _PlayingBuilderType.current: in lib/src/builders/player_builders.dart doesn't work because initialData is null.

This crash also appears with the non-nnbd version:
_loopSingleAudio(true) in assets_audio_player.dart crashes without exception.
You can test it in example/lib/main_test.dart which plays a single audio file and has a button for looping/not-looping.
When changing the loop mode via toggleLoop(), as used in example/old_main.dart, it works fine.

@kalismeras61 kalismeras61 changed the base branch from master to upgrade-null-safety March 19, 2021 06:41
@kalismeras61 kalismeras61 merged commit 92f6470 into florent37:upgrade-null-safety Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need flutter 2.0 support (Null safety)
4 participants