-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnimationController has lost it's vsync. #63088
Comments
hI @tomosullivan8 Please try this code sample Code Sampleimport 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
theme: ThemeData.dark(),
home: Home(),
);
}
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
AnimationController _animationController;
@override
void initState() {
super.initState();
_animationController =
AnimationController(vsync: this, duration: Duration(seconds: 1))
..forward()
..repeat(reverse: true);
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
child: Center(
child: AnimatedBuilder(
animation: _animationController,
builder: (context, child) {
return Container(
decoration: ShapeDecoration(
shape: CircleBorder(), color: Colors.white.withOpacity(.5)),
child: Padding(
padding: EdgeInsets.all(8.0 * _animationController.value),
child: child,
),
);
},
child: Container(
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: IconButton(
icon: Icon(
Icons.flight_takeoff,
size: 24,
color: Colors.black,
),
onPressed: () {}),
),
),
),
),
);
}
}
Screen Recording 2020-08-06 at 8.23.00 PM.zip flutter doctor -v
Can you please provide your |
Hello @TahaTesser , I have the lasest version of Flutter (same as the creator of this thread) and your code (the animationController statement) does not work. Vsync is still missing and asks for tickerProvider. Even if you give it, it will fail to compile. |
Hi @TahaTesser. I've tried upgrading to the latest master version again, but as @stefanodecillis mentioned it's a definite error as the If you have any other suggestions then let me know! Thanks Tom |
I would also add that I tried to modify the @required in the class and so get the vsync attribute. The problem is that results not to be a good candidate. Give the error mentioned in my thread. From it, you can probably find the commits where the error was made by mistake since it was written for null safety purpose |
@stefanodecillis if you switch to beta channel and then revert back to the master it seems to fix the problem! That's what I did and bingo the vsync is alive. If this fixes it for you please can you close this after. |
Agree, the solution worked. Thank you! |
This happened to me as well (im using flutter beta channel). I fixed it by updating dart. Now im using |
Switching to beta solves this issue |
change minimum sdk to 2.8 |
change minimum sdk to 2.8 This worked |
not working for me. solution for me stable and beta whit minimum sdk to 2.8
good lucky |
Worked for me |
The important part seems to be to use the minimum SDK 2.8. The rest, apart from restarting Android Studio, was not that important to me. |
This error occurred after I updated the stable channel. But none of these solutions worked for me. anyone can help me. Flutter is already up to date on channel stable Doctor summary (to see all details, run flutter doctor -v): [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • No issues found! |
If none of these work, check after restarting the PC. I've tried above mentioned all solutions even invalidate cache and restart option in android studio. But did not work. The issue has been resolved after the PC restarted. |
It's late I think but if someone get this issue in future so can refere below solution. class _onCreate extends State with TickerProviderStateMixin{ } just add with TickerProviderStateMixin this line and it will work. |
Delete .idea folder and reopen project and this should work with Android Studio. |
JUST RESTART YOUR COMPUTER |
Are you from the IT Crowd? 😂 |
What you call "restart a computer" simply do an "Invalidate cache and restart" in Android Studio (it's under File). |
just do |
Here we are, about a year later. With null-safety enabled this issue appeared again...
I guess I'm just not doing animations then. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
The AnimationController has lost it's
vsync
and is now requiringTickerProvider
.Error message:
I've checked the location of the AnimationController file and it's missing it's '@' before the required, I presume this is the issue and why it's caused my application to crash.
Flutter Doctor output;
The text was updated successfully, but these errors were encountered: