首页 文章

如何在Dart中使用animationFrame?

提问于
浏览
4

以下代码抛出异常 "type '([int]) => void' is not a subtype of type 'RequestAnimationFrameCallback' of 'callback'."

import 'dart:html';

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

如果我将 window.animationFrame.then 更改为 window.requestAnimationFrame ,一切都按预期工作 . 我误解了Dart期货的运作方式吗?

1 回答

  • 1

    用法看起来正确 .

    您正在运行尚未实现文档中指定的行为的旧版本,或者它只是一个错误 . 我会继续在http://dartbug.com/new上提出问题

相关问题