Files
jinzhi/lib/app/bootstrap.dart
T

35 lines
1.2 KiB
Dart

import 'dart:async';
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/widgets.dart';
import '../common/services/device_header_service.dart';
import '../common/config/shorebird_service.dart';
import '../common/config/umeng_config.dart';
import '../common/storage/storage_service.dart';
import '../common/widgets/easy_refresh_localization.dart';
import 'app.dart';
Future<Widget> bootstrap() async {
WidgetsFlutterBinding.ensureInitialized();
configureEasyRefreshChineseLocalization();
await UmengConfig.load();
await StorageService.instance;
if (!kIsWeb) {
if (Platform.isAndroid) {
// Before consent this only initializes app version and channel. The
// service resumes device identity initialization after consent.
await DeviceHeaderService.to.ensureInitialized();
} else {
await DeviceHeaderService.to.ensureInitialized();
}
}
if (!kIsWeb) {
// Shorebird's native updater performs the automatic launch-time update.
// Reading the running patch is diagnostic state and must not delay startup.
unawaited(ShorebirdService.instance.initCurrentPatch());
}
return const JinzhiApp();
}