Skip to content

Support NNBD #503

Closed
Closed
@hanabon

Description

@hanabon

🐛 Bug Report

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.

  • 'Duration' is from 'dart:core'.
    {Duration duration, void Function() callback}) {
    ^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:70:43: Error: Optional parameter 'callback' should have a default value because its type 'void Function()' doesn't allow null.
    {Duration duration, void Function() callback}) {
    ^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:128:10: Error: Optional parameter 'version' should have a default value because its type 'int' doesn't allow null.
    {int version,
    ^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:129:27: Error: Optional parameter 'onConfigure' should have a default value because its type 'FutureOr Function(Database)' doesn't allow null.
  • 'Database' is from 'package:sqflite_common/sqlite_api.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/sqlite_api.dart').
    OnDatabaseConfigureFn onConfigure,
    ^^^^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:130:24: Error: Optional parameter 'onCreate' should have a default value because its type 'FutureOr Function(Database, int)' doesn't allow null.
  • 'Database' is from 'package:sqflite_common/sqlite_api.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/sqlite_api.dart').
    OnDatabaseCreateFn onCreate,
    ^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:131:31: Error: Optional parameter 'onUpgrade' should have a default value because its type 'FutureOr Function(Database, int, int)' doesn't allow null.
  • 'Database' is from 'package:sqflite_common/sqlite_api.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/sqlite_api.dart').
    OnDatabaseVersionChangeFn onUpgrade,
    ^^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:132:31: Error: Optional parameter 'onDowngrade' should have a default value because its type 'FutureOr Function(Database, int, int)' doesn't allow null.
  • 'Database' is from 'package:sqflite_common/sqlite_api.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/sqlite_api.dart').
    OnDatabaseVersionChangeFn onDowngrade,
    ^^^^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/sqflite.dart:133:22: Error: Optional parameter 'onOpen' should have a default value because its type 'FutureOr Function(Database)' doesn't allow null.
  • 'Database' is from 'package:sqflite_common/sqlite_api.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/sqlite_api.dart').
    OnDatabaseOpenFn onOpen,
    ^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/factory_impl.dart:10:24: Error: Field '_databaseFactory' should be initialized because its type 'SqfliteDatabaseFactory' doesn't allow null.
  • 'SqfliteDatabaseFactory' is from 'package:sqflite_common/src/factory.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/src/factory.dart').
    SqfliteDatabaseFactory _databaseFactory;
    ^^^^^^^^^^^^^^^^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/factory_impl.dart:42:30: Error: The value 'null' can't be assigned to a variable of type 'SqfliteDatabaseFactory' because 'SqfliteDatabaseFactory' is not nullable.
  • 'SqfliteDatabaseFactory' is from 'package:sqflite_common/src/factory.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/src/factory.dart').
    sqfliteDatabaseFactory = 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.

  • 'SqfliteDatabaseFactory' is from 'package:sqflite_common/src/factory.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/src/factory.dart').
    _databaseFactory ??= SqfliteDatabaseFactoryImpl();
    ^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/factory_impl.dart:67:5: Warning: Operand of null-aware operation '??=' has type 'SqfliteDatabaseFactory' which excludes null.
  • 'SqfliteDatabaseFactory' is from 'package:sqflite_common/src/factory.dart' ('../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/src/factory.dart').
    _databaseFactory ??= SqfliteDatabaseFactoryImpl();
    ^
    ../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/src/sqflite_impl.dart:17:13: Error: A value of type 'Future<T?>' can't be returned from a function with return type 'Future' because 'T?' is nullable and 'T' isn't.
  • 'Future' is from 'dart:async'.
    channel.invokeMethod(method, arguments);

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
`

Expected behavior

App should run without errors like it did prior to making the non nullable change.

Reproduction steps

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",

Configuration

Version: 1.x
Version 2.3.3

Platform:

  • 📱 iOS
  • 🤖 Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions