g0rdan/Flutter.Bird

Running well but one exception keep showing..

Closed this issue · 5 comments

dvlj commented

Any idea?

════════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
Failed assertion: boolean expression must not be null

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md

When the exception was thrown, this was the stack
#0 Animation.update
package:flame/animation.dart:149
#1 AnimationComponent.update
package:flame/components/animation_component.dart:49
#2 BirdGround.update
package:flutter_bird/game/bird.dart:115
#3 Bird.update
package:flutter_bird/game/bird.dart:81
#4 FlutterBirdGame.update
package:flutter_bird/game/game.dart:83
...

This exception was thrown in the context of a scheduler callback. When the scheduler callback was registered (as opposed to when the exception was thrown), this was the stack
#0 new _FrameCallbackEntry.
package:flutter/…/scheduler/binding.dart:112
#1 new _FrameCallbackEntry
package:flutter/…/scheduler/binding.dart:115
#2 SchedulerBinding.scheduleFrameCallback
package:flutter/…/scheduler/binding.dart:459
#3 _GameRenderBox._scheduleTick
package:flame/game.dart:108
#4 _GameRenderBox._tick
package:flame/game.dart:117
...
════════════════════════════════════════════════════════════════════════════════

I haven't been touching the project for a while, so at the moment I can't provide an answer. But I'll look up on the issue. Have you tried to update Flame package?

dvlj commented

flutter version 1.9.1
flame: 0.10.2. <- working but above error
flame: 0.16.0. <- cant even compile, current code not compatible

First, I would like to thank you for the project. Congratulations. I had the same problems. Test various combinations between Flame and Flutter_svg. Putting both in their most recent versions does not work. I managed to find the right combination
add lines in file "pubspec.yaml"

flame: ^0.15.2
flutter_svg: ^ 0.14.0

Also, add this line " WidgetsFlutterBinding.ensureInitialized(); " to the main.dart file:

void main() async {

  // initial settings
  WidgetsFlutterBinding.ensureInitialized();

............

@diegolg13 Thank you a lot! Honestly, after the last commit, I didn't touch the app at all. I feel shame a bit. Thanks for fixing the bug.

There is no reason to apologize. It turns out that people will download your project and will probably be using an updated version of the flutter.
So there had always been problems. This is part of programming. Your project taught me a lot, please do more. haha ha. maybe an Angry Birds now.