W/Choreographer(11277): Frame time is 13.988632 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
Run Code Online (Sandbox Code Playgroud)
这是运行时产生的错误。Flutter 未更新setState内容并出现此错误,代码如下
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:math';
void main() {
runApp(
MaterialApp(
home: Scaffold(
backgroundColor: Colors.redAccent,
appBar: AppBar(
backgroundColor: Colors.red,
title: Center(child: Text('Dicee')),
),
body: MyApp(),
),
),
);
}
class MyApp extends StatefulWidget {
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
int leftDiceNumber = 1;
@override
Widget build(BuildContext context) {
leftDiceNumber = 4;
return Center(
child: Row(
children: <Widget>[
Expanded(
child: FlatButton(
onPressed: () {
setState(() {
leftDiceNumber = (Random().nextInt(6) + 1);
print('images/dice$leftDiceNumber.png');
});
},
child: Image.asset('images/dice$leftDiceNumber.png'),
),
),
Expanded(
child: FlatButton(
onPressed: () {
setState(() {
leftDiceNumber = 5;
});
},
child: Image.asset('images/dice6.png'),
),
),
],
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题
Joe*_*ler -1
我在尝试在应用程序中使用两个 Firebase 项目时遇到此错误。看来很多Firebase 数据在重新启动之间仍然保留。
为了解决这个问题,我必须注释掉对 Firebase.initializeApp() 的调用并运行该应用程序一次。这似乎清除了导致错误的原因。
| 归档时间: |
|
| 查看次数: |
2682 次 |
| 最近记录: |