Search code examples
flutterflutter-layoutflutter-animationflutter-test

'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 246 pos 15: 'vsync != null': is not true


After updating Flutter Environment I getting this problem. Please help me for this issue.

 @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,
            ),
          )),
    );
  }

Please Help me as soon as possible.


Solution

  • Following this github issue: AnimationController has lost it's vsync,

    you can follow the following steps to fix the issue:

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