小编Muh*_*hid的帖子

在 flutter dart 中对 null 调用了方法“findAncestorStateOfType”

我正在创建一个应用程序,我是扑扑,飞镖的新手。我在“上下文”中有问题。我想替换页面/屏幕 onTab()。但我有以下错误:


> ?????? Exception caught by gesture ???????????????????????? The
> following NoSuchMethodError was thrown while handling a gesture: The
> method 'findAncestorStateOfType' was called on null. Receiver: null
> Tried calling: findAncestorStateOfType<NavigatorState>()

Run Code Online (Sandbox Code Playgroud)

这是我的代码:

class Theorytest extends StatelessWidget {

    Widget  customcard(String testName ){
      return Padding(
        padding: EdgeInsets.all(10.0),
        child: InkWell(
          onTap: (){

                      Navigator.of(context).pushReplacement(MaterialPageRoute(

              builder: (context) => GetTestData(),
           ),
           );
          },
          child: Material(     
            borderRadius: BorderRadius.circular(50.0),
            elevation: 20.0,
            child : Container(
              child: Column(
                children : <Widget>[
                  Padding(
                    padding: EdgeInsets.fromLTRB(5.0, 20.0, 10.0, 20.0),
                    child: …
Run Code Online (Sandbox Code Playgroud)

exception dart flutter

8
推荐指数
1
解决办法
1万
查看次数

执行“Flutter Clean”命令后,项目构建文件夹被删除。现在,我无法运行或构建应用程序

如何检索构建文件夹并运行应用程序。我试过以下命令。

flutter run
flutter create appbundle
Run Code Online (Sandbox Code Playgroud)

但一切都是徒劳的。现在我无法在模拟器上运行我的应用程序,也无法构建 apk 文件。

请帮忙,我是新来的。这里是日志。

Invalid depfile: H:\appsss\app\prepare_yourself_for_exams\.dart_tool\flutter_build\902f3633de5fdde27e4ce7360b2460ff\kernel_snapshot.d

Invalid depfile: H:\appsss\app\prepare_yourself_for_exams\.dart_tool\flutter_build\902f3633de5fdde27e4ce7360b2460ff\kernel_snapshot.d



Compiler message:

/H:/InstallationPath/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:1:8: Error:
Not found: 'dart:html'

import 'dart:html';

       ^

/H:/InstallationPath/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib/js.dart:8:1: Error: Not found: 'dart:js'

export 'dart:js' show allowInterop, allowInteropCaptureThis;

^

/H:/InstallationPath/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'

export 'dart:js_util';

^

/H:/InstallationPath/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:306:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.

 - 'Auth' is from 'package:firebase/src/auth.dart' ('/H:/InstallationPath/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').

Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.

      var …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-dependencies

2
推荐指数
2
解决办法
2607
查看次数

标签 统计

dart ×2

flutter ×2

exception ×1

flutter-dependencies ×1