Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10月22日上午突然报错 #166

Closed
01BAI opened this issue Oct 22, 2020 · 6 comments
Closed

10月22日上午突然报错 #166

01BAI opened this issue Oct 22, 2020 · 6 comments

Comments

@01BAI
Copy link

01BAI commented Oct 22, 2020

之前在调试,一切正常,突然报错,错误如下

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Builder:

Ensure to initialize ScreenUtil before accessing it.
'package:flutter_screenutil/screenutil.dart':
Failed assertion: line 31 pos 7: '_instance != null'

The relevant error-causing widget was
MaterialApp
lib/main.dart:15
When the exception was thrown, this was the stack
#2 new ScreenUtil
package:flutter_screenutil/screenutil.dart:31
#3 duSetFontSize
package:group_gate/…/utils/screen.dart:20
#4 new _SignInPageState
package:group_gate/…/sign_in/sign_in.dart:316
#5 SignInPage.createState
package:group_gate/…/sign_in/sign_in.dart:14
#6 new StatefulElement
package:flutter/…/widgets/framework.dart:4716
...
════════════════════════════════════════════════════════════════════════════════

@01BAI
Copy link
Author

01BAI commented Oct 22, 2020

Flutter 1.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 84f3d28555 (6 days ago) • 2020-10-15 16:26:19 -0700
Engine • revision b8752bbfff
Tools • Dart 2.10.2

@lizhuoyuan
Copy link
Collaborator

lizhuoyuan commented Oct 22, 2020

版本号是多少
看起来是没有初始化

@01BAI
Copy link
Author

01BAI commented Oct 22, 2020

版本号是多少
看起来是没有初始化

flutter_screenutil: ^3.1.0
我现在可以做什么样操作尝试修复吗?

@lizhuoyuan
Copy link
Collaborator

在进入的第一个页面里调用初始化方法 ScreenUtil.init()
可参考example或者看一下文档

@01BAI
Copy link
Author

01BAI commented Oct 22, 2020

image
有调用初始化方法
之前是好好的

@01BAI
Copy link
Author

01BAI commented Oct 22, 2020

找到问题了,是我自己页面上的东西影响的初始化,谢谢了!

@01BAI 01BAI closed this as completed Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants