'package:flutter / src / animation / animation_controller.dart':断言失败:第246行pos 15:'vsync!= null':不正确

时间:2020-08-25 17:06:21

标签: flutter flutter-layout flutter-animation flutter-test

更新Flutter Environment之后,出现此问题。请帮我解决这个问题。

 @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 4,
      child: Scaffold(
          appBar: topBar(), 
          body: TabBarView( // problem indicates here
            children: _kTabPages,
            controller: _tabController,
          ),

          // Button Navigation
          bottomNavigationBar: Material(
            color: Colors.redAccent,
            child: TabBar(
              tabs: _kTabs,
              controller: _tabController,
            ),
          )),
    );
  }

请尽快帮助我。

1 个答案:

答案 0 :(得分:4)

以下是github问题:AnimationController has lost it's vsync

您可以按照以下步骤解决此问题:

1. Change minimum sdk to 2.8
2. Run flutter upgrade
3. Run flutter pub get
4. Run flutter clean
5. Restart IDE