Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use animationFrame in Dart?

Tags:

dart

dart-html

The following code throws the exception "type '([int]) => void' is not a subtype of type 'RequestAnimationFrameCallback' of 'callback'."

import 'dart:html';

void main() {
  window.animationFrame.then((time) => print("test"));
}

If I change window.animationFrame.then to window.requestAnimationFrame, everything works as expected. Am I misunderstanding how Dart futures work?

like image 530
Sydius Avatar asked Nov 12 '22 09:11

Sydius


1 Answers

Usage looks right.

Either you are running an older version that doesn't yet implement the behavior that is specified in the documentation or it is simply a bug. I would go ahead and file an issue on http://dartbug.com/new

like image 87
Florian Loitsch Avatar answered Dec 20 '22 07:12

Florian Loitsch