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

调用 Intro.of(context).start() 时会出现 Unhandled Exception: Null check operator used on a null value #2

Open
keepgagaga opened this issue Sep 27, 2022 · 3 comments

Comments

@keepgagaga
Copy link

单独跑 demo 没问题,但是按照 demo 加在页面里就出了这个错,百思不得其解

@xianziljl
Copy link

xianziljl commented Apr 4, 2023

遇到同样的问题,请问解决了吗?

@LiGaoLiang7
Copy link


@Aaronwk
Copy link

Aaronwk commented Apr 2, 2024

遇到同样的问题,请问解决了吗?

你需要把Intro包裹在class的外层。而不是build内的树的跟节点。
例如有一个界面是:HomePage

错误的写法是:

@override
  Widget build(BuildContext context) {
   return Intro(child: IntroStepBuilder(child:Text('data')))
  }

正确的写法是:

第一层
Intro(child: HomePage()),

第二层(HomePage内部)

class HomePage extends StatefulWidget{
//...
@override
  Widget build(BuildContext context) {
   return IntroStepBuilder(child:Text('data'))
  }
}

遵循以上结构才可以,

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

4 participants