runMyApp function
void
runMyApp(
- Widget app, {
- dynamic enableLog = false,
- RoundAppRun? beforeRun,
- bool initWeChat = false,
- String? crashPrefixMsg,
- RoundAppRun? afterRun,
- bool clearGetxControllersBeforeExit = true,
Implementation
void runMyApp(
Widget app, {
/// 是否开启日志
enableLog = false,
/// 自定义启动前执行
RoundAppRun? beforeRun,
/// 初始化仿微信图片选择
bool initWeChat = false,
/// 是否开启日志
String? crashPrefixMsg,
/// 自定义启动后执行
RoundAppRun? afterRun,
/// 退出应用时,注销所有getx的controller
bool clearGetxControllersBeforeExit = true,
}) {
WidgetsFlutterBinding.ensureInitialized();
LogUtils.initLog(enable: enableLog);
if (clearGetxControllersBeforeExit) {
MyGet.actionsBeforeExitApp.add(() {
clearAllGetxControllers();
});
}
baseBeforeRun().then((value) {
/// 自定义启动前执行
if (beforeRun != null) {
beforeRun.call().then((value) {
runBaseApp(
app,
initWeChat: initWeChat,
crashPrefixMsg: crashPrefixMsg,
afterRun: afterRun,
);
});
} else {
runBaseApp(
app,
initWeChat: initWeChat,
crashPrefixMsg: crashPrefixMsg,
afterRun: afterRun,
);
}
});
}