2016-09-02 10 views
1

flutter_galleryの例を拡張しています。最上位のゲッターがありません<className>が宣言されました

私は新しいギャラリーアイテム

new GalleryItem(
    title: 'Journal', 
    subtitle: 'Example app coding', 
    category: 'Apps', 
    routeName: JournalDemo.routeName, 
    buildRoute: (BuildContext context) => new JournalDemo() 
), 

を作成しようと、私はexport 'journal_demo.dart';

JournalDemoクラスを持っている内部私はimport '../journal/journal_all.dart';

輸入がListDemoと同じクラスで、私は、クラス名を変更し、州名:

class JournalDemo extends StatefulWidget { 
    JournalDemo({ Key key }) : super(key: key); 

    static const String routeName = '/journal'; 

    @override 
    JournalDemoState createState() => new JournalDemoState(); 
} 

class JournalDemoState extends State<JournalDemo> { 
....... 

これは私が

I/flutter : ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter : The following NoSuchMethodError was thrown building GalleryApp(dirty; state: I/flutter : GalleryAppState(48280642)): I/flutter : No top-level getter 'JournalDemo' declared. I/flutter : NoSuchMethodError: method not found: 'JournalDemo' I/flutter : Receiver: top-level I/flutter : Arguments: [...] I/flutter : When the exception was thrown, this was the stack: I/flutter : #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:184) I/flutter : #1 kAllGalleryItems (/Users/matej/IdeaProjects/flutter/journal/lib/gallery/item.dart:51) I/flutter : #2 kAllGalleryItems (/Users/matej/IdeaProjects/flutter/journal/lib/gallery/item.dart:45)

私は何を変更する必要がありますを取得する例外では?

は、あなたが不足しているインポートまたはあなたのコード内でパースエラーのいずれかを持っているようにこれが見えます

+0

[email protected]にメールを送信したり、GoogleのGitterに参加して、私たち(Flutter開発者)にお気軽にお問い合わせください。https://gitter.im/flutter/flutter助けて。 –

+0

アナライザは何を言いますか? (アプリケーションディレクトリの 'flutter analyze') –

+0

これをローカルで再現することができませんでした。 https://gitter.im/flutter/flutterであなたと協力してさらにデバッグしてください。 –

答えて

1

ありがとうございます。上記のポスターの1つとして、flutter analyzeで確認することをお勧めします。

No top-level getter 'JournalDemo' declaredは、グローバルスコープで値JournalDemoを見つけることができないことを意味します。インポートされていないか、このエラーが発生する前に解析エラーが発生しているためです。

関連する問題