30 lines
1.0 KiB
Dart
30 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_template/app/app.dart';
|
|
import 'package:flutter_template/app/config/app_config.dart';
|
|
import 'package:flutter_template/core/cache/app_storage.dart';
|
|
import 'package:flutter_template/core/logging/app_logger.dart';
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
|
|
|
class AppBootstrapper {
|
|
AppBootstrapper._();
|
|
|
|
static Future<void> bootstrap({
|
|
AppEnvironment environment = AppEnvironment.dev,
|
|
}) async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
|
|
|
await AppStorage.init();
|
|
final packageInfo = await PackageInfo.fromPlatform();
|
|
|
|
AppConfig.configure(environment: environment, packageInfo: packageInfo);
|
|
|
|
AppLogger.debug('App started in ${AppConfig.current.environment.name}');
|
|
|
|
runApp(const ProviderScope(child: FlutterTemplateApp()));
|
|
}
|
|
}
|