alibaba / alibaba/flutter_boost

demo中使用FlutterBoostApp包裹的 appBuilder, 怎么指定自己的widget ???

Open
#1,616 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Widget appBuilder(Widget home) {
return MaterialApp(
home: home,
debugShowCheckedModeBanner: false,

///必须加上builder参数,否则showDialog等会出问题
builder: (_, __) {
return home;
},
);
}

@override
Widget build(BuildContext context) {
return FlutterBoostApp(
routeFactory,
appBuilder: appBuilder,
);
}

如上,是demo的写法...我自己的项目,,我把appBuilder内的 home 改成自己的根widget,为何 一运行 ,代码就报错...

======== Exception caught by scheduler library =====================================================
The following _CastError was thrown during a scheduler callback:
Null check operator used on a null value

When the exception was thrown, this was the stack:
#0 BoostChannel.addEventListener (package:flutter_boost/src/boost_channel.dart:32:21)
#1 FlutterBoostAppState._addAppLifecycleStateEventListener (package:flutter_boost/src/flutter_boost_app.dart:119:10)
#2 FlutterBoostAppState.initState. (package:flutter_boost/src/flutter_boost_app.dart:108:7)
#3 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
#4 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1090:9)
#5 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:863:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
====================================================================================================

这怎么办???

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the custom appBuilder and FlutterBoostApp usage shown in the report, then inspect boost_channel.dart:32 and flutter_boost_app.dart:108-119 around the lifecycle listener. Reproduce the scheduler callback failure and determine why replacing home produces a null value; done means the custom root widget starts without the reported cast error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.