Currently using Non Nullable for flutter, all other dependencies work fine except for cached_network_image. Now I'm getting a long list of errors and the app cannot run nor build.
Here is the long list of errors I'm getting:
`
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/compat.dart:1:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/compat.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:5:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/compat.dart' show SqfliteOptions;
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/constant.dart:1:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/constant.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/utils.dart:1:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/utils.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/utils/utils.dart:1:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/utils/utils.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqlite_api.dart:1:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/sqlite_api.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:18:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/factory_mixin.dart'
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:8:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/database.dart' // ignore: implementation_imports
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:12:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/database_mixin.dart' // ignore: implementation_imports
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:16:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/exception.dart'
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:20:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/factory.dart' show SqfliteDatabaseFactory;
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:21:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/mixin/constant.dart'
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_import.dart:32:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/mixin/factory.dart'
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sql_builder.dart:1:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite_common/src/sql_builder.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:13:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite/src/compat.dart';
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:16:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'sqlite_api.dart';
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sql.dart:5:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite/src/sql_builder.dart'
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:12:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
export 'package:sqflite/sql.dart' show ConflictAlgorithm;
^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:70:17: Error: Optional parameter 'duration' should have a default value because its type 'Duration' doesn't allow null.
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/factory_impl.dart:53:5: Warning: Operand of null-aware operation '??=' has type 'SqfliteDatabaseFactory' which excludes null.
FAILURE: Build failed with an exception.
Where:
Script '/../flutter_tools/gradle/flutter.gradle' line: 900
What went wrong:
Execution failed for task ':app:compileFlutterBuildDevDebug'.
Process 'command '/../flutter/bin/flutter'' finished with non-zero exit value 1
`
App should run without errors like it did prior to making the non nullable change.
In pubspec.yaml:
`environment:
sdk: ">=2.10.0 <3.0.0"
dependencies:
cached_network_image: ^2.3.3`
Added analysis_options.yaml:
analyzer:
enable-experiment:
- non-nullable
In my launch.json for VS code, I added the args
"--enable-experiment=non-nullable",
"--no-sound-null-safety",
Version: 1.x
Version 2.3.3
Platform:
I didn't have a look at it yet, but seeing your errors it looks like sqflite will need to migrate first. Looks like that is going to beta soon: https://github.com/tekartik/sqflite/issues/529
Thanks for the heads up, I just saw they released today 2.0.0-nullsafety.1 as a prelease
OctoImage is almost migrated: https://github.com/Baseflow/octo_image/pull/16. That's waiting for some packages that should have an update soon.
@renefloor octo_image has now migrated to nnbd (1.0.0-nullsafety.1). It would be great if this package could also be migrated soon. I can help if needed.
I wanted to migrate this lib, but it still needs flutter_cache_manager to migrate first.
I've gone and done that instead: https://github.com/Baseflow/flutter_cache_manager/pull/278.
It looks like flutter_cache_manager is now migrated to null safety.
Does someone have time to migrate this library?
I can try to migrate this package as I've just migrated mine :) But looks like octo_image package also needs to be migrated. Anyone want to try?
@bartektartanus octo_image is already migrated: https://pub.dev/packages/octo_image/versions/1.0.0-nullsafety.1
@jlubeck Indeed! My bad. :) Ok, I've started this migration.
Code seems to look fine now, but I'm struggling with tests. I have some troubles with mockito and migrating the mocks. Now the mocks needs to be generated by build_runner with annotation @GenerateMocks. Looks like it does not work with mixins yet. So I can't generate mock for ImageCacheManager.
Will try again tomorrow and submit my work in progress MR.
Ok, PR is ready, but it's still WIP. Maybe someone with better knowledge of this package and mockito will rewrite tests?
Why is the version 3.0.0-nullsafety on pub.dev not showing the null safety badge?
The null safety badge will appear only once a stable version is released.
Please, can you re-check it? Because other plugins on pub.dev has also a pre-released version WITH the null safety badge. If I can help you somehow let me know. 馃槑馃憤
@rlazom I've only ever seen the Null Safety badge for stable nullsafe releases (if you found a counter example, I would be interested if you could say which one). Though I don't think it's a problem, it's actually a motivation to get a stable release out soon ;-)
@ryanheise this is my pre-release package with the badge https://pub.dev/packages/flutter_widget_from_html_core/versions/0.6.0-rc.2021030401

Maybe it is a bug in pub.dev, but I would point out that the Dart migration guide provided specific recommendations for null safety prereleases and it's possible that things aren't behaving correctly unless you follow those recommendations.
In this case, a nullsafe prerelease should be named something like 0.6.0-nullsafety.0 (where the 0 gets incremented for each successive prerelease version).
Most helpful comment
I wanted to migrate this lib, but it still needs
flutter_cache_managerto migrate first.I've gone and done that instead: https://github.com/Baseflow/flutter_cache_manager/pull/278.