我对super.initSate()
在 Flutter 中调用的位置感到困惑?在一些代码示例中,它在开始时被调用,而在其他代码示例中则在最后被调用。有区别吗?
我试图用谷歌搜索这个,但没有找到关于这个函数调用位置的任何解释。
哪一个是正确的?
void initState() {
super.initState();
//DO OTHER STUFF
}
Run Code Online (Sandbox Code Playgroud)
或者
void initState() {
//DO OTHER STUFF
super.initState();
}
Run Code Online (Sandbox Code Playgroud) 我的 Google Play 控制台中有很多 Flutter 应用程序的 ANR 报告。我如何确定我的 flutter 应用程序中的哪一行导致了问题,因为我在报告中看到的唯一行号是针对 Java 文件的。有没有办法可以将这些追溯到实际的颤振文件?
以下是 ANR 报告中的代码示例:
"main" tid=1 Native
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x753d2890 self=0x7784c14c00
| sysTid=5725 nice=-10 cgrp=default sched=0/0 handle=0x780af11550
| state=S schedstat=( 783263348209 325919126195 1054920 ) utm=51688 stm=26637 core=1 HZ=100
| stack=0x7fd6d7f000-0x7fd6d81000 stackSize=8MB
| held mutexes=
#00 pc 000000000001f2ac /system/lib64/libc.so (syscall+28)
#01 pc 00000000000d7e50 /system/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
#02 pc 0000000000333fdc /system/lib64/libart.so (art::JNI::CallObjectMethod(_JNIEnv*, _jobject*, _jmethodID*, ...)+556)
#03 pc 00000000000f896c /system/lib64/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long, int, unsigned int)+48)
#04 pc …
Run Code Online (Sandbox Code Playgroud)