Just_audio: Support null safety

Created on 28 Nov 2020  Â·  13Comments  Â·  Source: ryanheise/just_audio

Is your feature request related to a problem? Please describe.

This plugin can't be used with null safety enabled.

Describe the solution you'd like

Create a null safety preview release.

Describe alternatives you've considered

None

Additional context

The dependencies must be migrated to null safety first. All dependencies have been migrated already except for audio_session.

3 testing enhancement

Most helpful comment

path_provider has now been migrated to null safety. I'll try to update just_audio when I get chance today.

All 13 comments

This has now been unblocked.

This has now been unblocked.

Great job @ryanheise! Thanks for your package, it's currently is one and only, that is on the good way to null-safety.

It turns out path_provider is also blocking. It seems to be partially migrated, though, so maybe complete migration is around the corner, after which I'll release a nullsafe just_audio.

I decided to temporarily remove the path_provider dependency and embed that functionality into just_audio. With that, I was able to release a null-safe release of just_audio. I'll switch back to path_provider once it gets a null-safe release (which should be soon).

A pub error which I ignored:

$ flutter packages pub publish --dry-run
Publishing just_audio 0.7.0-nullsafety.0 to https://pub.dartlang.org:
..........
Package validation found the following potential issue:
* This package is opting into null-safety, but a dependency or file is not.

  package:sky_engine/js_util/js_util_dart2js.dart is opting out of null safety:
    â•·
  5 │ // @dart = 2.6
    │ ^^^^^^^^^^^^^^
    ╵

  Note that by publishing with non-migrated dependencies your package may be
  broken at any time if one of your dependencies migrates without a breaking 
  change release. 

  We highly recommend that you wait until all of your dependencies have been 
  migrated before publishing.

  Run `pub outdated --mode=null-safety` for more information about the state of
  dependencies.

  See https://dart.dev/null-safety/migration-guide
  for more information about migrating.

Package validation found the following hint:
* You're about to publish a package that opts into null safety.
  The previous version (0.6.9) isn't opted in.
  See https://dart.dev/null-safety/migration-guide for best practices.

Package has 1 warning and 1 hint..
pub finished with exit code 65

I decided to temporarily remove the path_provider dependency and embed that functionality into just_audio. With that, I was able to release a null-safe release of just_audio. I'll switch back to path_provider once it gets a null-safe release (which should be soon).

You don't have to import an external library if you don't need it. If you are happy with your implementation of the functionality that you use, you can keep that.

True, but I do still plan to restore the path_provider dependency as soon as it is migrated, though, simply because path_provider is a high quality dependency (1st party plugin developed by Google) with support for additional platforms which I may want to support in the future, and barring this speed bump with the null safety migration, will make the just_audio code simpler to maintain.

I've just put out another null-safety release relaxing the sdk constraint slightly.

path_provider has now been migrated to null safety. I'll try to update just_audio when I get chance today.

I have just published a just_audio 0.7.0-nullsafety.3 . This is a a release candidate for the 0.7.0 stable release.

Please try it out and let me know if you encounter any issues, otherwise I'll proceed to publish a stable release within the next day or two.

just_audio 0.7.0 stable has been released!

It's been a hectic 3 months from the initial migration of audio_session back in November of last year, to now, particularly with maintaining two branches of each plugin. But from here on, all new development will happen on the null safety branch which will be a huge weight off my shoulders.

The plan is to merge nnbd into master as soon as Flutter release null safety on the stable branch.

With the job complete, I'll now close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lain-ke picture lain-ke  Â·  4Comments

suragch picture suragch  Â·  9Comments

snaeji picture snaeji  Â·  10Comments

ryanheise picture ryanheise  Â·  7Comments

ali-alizadeh picture ali-alizadeh  Â·  6Comments