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

最新版本的Flutter Demo启动报错 #40

Closed
kumanman opened this issue May 24, 2022 · 4 comments
Closed

最新版本的Flutter Demo启动报错 #40

kumanman opened this issue May 24, 2022 · 4 comments

Comments

@kumanman
Copy link

/D:/SDK/flutter_2.10.3/.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub%2547/percent_indicator-4.2.1/lib/linear_percent_indicator.dart:162:5: Warning: The class 'WidgetsBinding' cannot be null.
Try replacing '?.' with '.'
WidgetsBinding?.instance.addPostFrameCallback((_) {
^^^^^^^^^^^^^^
/D:/SDK/flutter_2.10.3/.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub%2547/percent_indicator-4.2.1/lib/linear_percent_indicator.dart:162:30: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/D:/SDK/flutter_2.10.3/packages/flutter/lib/src/widgets/binding.dart').
    Try calling using ?. instead.
    WidgetsBinding?.instance.addPostFrameCallback((_) {
    ^^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script 'D:\SDK\flutter_2.10.3\packages\flutter_tools\gradle\flutter.gradle' line: 1102

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'D:\SDK\flutter_2.10.3\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1

@Rose0103
Copy link

我也是这个问题

@hrxiang
Copy link
Contributor

hrxiang commented May 30, 2022

还没迁移到 3.0。需要等等

@floki2020
Copy link

你的sdk 不是2.10.3的嘛,但是我的也是这个问题,请问你的修复好了嘛?

@hrxiang
Copy link
Contributor

hrxiang commented Jul 6, 2022

最新的是3.0+

@hrxiang hrxiang closed this as completed Jul 6, 2022
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

No branches or pull requests

4 participants