【问题标题】:When trying Widget of flutter, NoSuchMethodError was thrown saying The method '_debugTypesAreRight' was called on null尝试颤动的 Widget 时,抛出 NoSuchMethodError 说 The method '_debugTypesAreRight' was called on null
【发布时间】:2018-11-08 03:58:50
【问题描述】:

我正在尝试一个简单的颤振飞镖程序。我指的是this教程,我该如何解决这个问题?

得到以下异常

I/flutter ( 4785): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 4785): The following NoSuchMethodError was thrown attaching to the render tree:
I/flutter ( 4785): The method '_debugTypesAreRight' was called on null.
I/flutter ( 4785): Receiver: null
I/flutter ( 4785): Tried calling: _debugTypesAreRight(Instance of 'RealWorldApp')

代码是:

import 'package:flutter/material.dart';

void main() => runApp(new RealWorldApp());

class RealWorldApp extends StatefulWidget {
  @override
  RealWorldState createState() => new RealWorldState();

}
 class RealWorldState extends State<RealWorldApp>
  {
  @override
  Widget build(BuildContext context) {
  return new MaterialApp(
    home: new Scaffold(
      appBar: new AppBar(
        title: new Text("First App"),
        actions: <Widget>[
          new IconButton(icon: new Icon(Icons.refresh),
          )
        ],
      ),
      body: new Center(
        child: new CircularProgressIndicator(),
      ),
    ),
  );
  }

  }

【问题讨论】:

    标签: android-studio dart flutter


    【解决方案1】:

    这是一个内部错误,并非您的代码有问题。请尝试以下操作:

    flutter upgrade &&           # use latest version
    flutter packages get &&      # pub_get all packages
    flutter clean &&             # delete caches
    flutter build                # rebuild
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 2019-12-05
      • 1970-01-01
      • 2019-12-06
      • 1970-01-01
      • 2019-12-10
      • 2021-08-28
      相关资源
      最近更新 更多