skip to Main Content

I’m developping my first app with Flutter and Firebase. I built it one time, far before connecting it to Firebase. Now I have done it at 90% but I can’t build the apk and not able to correct to error caused while building it. I need help.

This is the error :

  C:UsersAsusflutterbinflutter.bat --no-color build apk

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Running Gradle task 'assembleRelease'...                        
../../flutter/.pub-cache/hosted/pub.dartlang.org/charts_flutter-0.12.0/lib/src/chart_container.dart:205:27: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../flutter/packages/flutter/lib/src/scheduler/binding.dart').
    if (!SchedulerBinding.instance!.hasScheduledFrame) {
                          ^
../../flutter/.pub-cache/hosted/pub.dartlang.org/charts_flutter-0.12.0/lib/src/chart_container.dart:206:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../flutter/packages/flutter/lib/src/scheduler/binding.dart').
      SchedulerBinding.instance!.scheduleFrame();
                       ^
../../flutter/.pub-cache/hosted/pub.dartlang.org/charts_flutter-0.12.0/lib/src/chart_container.dart:209:22: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../flutter/packages/flutter/lib/src/scheduler/binding.dart').
    SchedulerBinding.instance!.addPostFrameCallback(startAnimationController);
                     ^
../../flutter/.pub-cache/hosted/pub.dartlang.org/charts_flutter-0.12.0/lib/src/chart_container.dart:232:22: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../flutter/packages/flutter/lib/src/scheduler/binding.dart').
    SchedulerBinding.instance!.addPostFrameCallback(doRebuild);
                 ^

Thank you

2

Answers


  1. Chosen as BEST ANSWER

    I saw the problem, the fact is the plugin charts_flutter is deprecated on the version of flutter that I have. So I drop it out and the type of error never print again. Even if my app isn't okay yet, because of other kind of error.


  2. Some changes happened in null-safety properties at the last upgrade of Flutter 3.0.0. There are a few approaches to a solution.

    1-) Upgrade to latest version of flutter. It will solve your issue.

     Flutter upgrade
    

    2-) If you upgraded the latest Flutter version and if your error is in the Flutter Core codes you must try;

    - dart fix --apply
    

    (Ref: https://docs.flutter.dev/development/tools/sdk/release-notes/release-notes-3.0.0)

    3-) If this solution doesn’t fix any error you can downgrade the Flutter version;

    - flutter downgrade v2.10.5
    

    4-) If you didn’t upgrade or the error is in the third-party package;

    The developer of this package may have upgraded this package to the recent version of Flutter. You can upgrade packages with;

    flutter pub upgrade --major-versions
    

    If the developer hasn’t upgraded yet, you must go to this package’s Github repo and look at the issue tab. Maybe someone opened an issue and the dev answered the correct running version. For example, GetX’s latest compatible version with Flutter 2.10.5 is 4.6.1. So for applying this version you can just use the version constraint (remove ˆ).
    Update

    get: ˆ4.6.1
    

    to

    get: 4.6.1
    

    in your pubspec.

    (Ref: https://github.com/jonataslaw/getx/issues/2356)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search