nc-photos/app/lib/main.dart

36 lines
1 KiB
Dart
Raw Normal View History

2022-07-28 18:59:26 +02:00
import 'dart:async';
2022-07-09 07:59:09 +02:00
import 'package:bloc/bloc.dart';
import 'package:bloc_concurrency/bloc_concurrency.dart';
2021-04-10 06:28:12 +02:00
import 'package:flutter/material.dart';
2022-01-17 11:59:40 +01:00
import 'package:flutter/services.dart';
2022-07-09 07:59:09 +02:00
import 'package:logging/logging.dart';
2022-03-27 19:55:31 +02:00
import 'package:nc_photos/app_init.dart' as app_init;
import 'package:nc_photos/platform/k.dart' as platform_k;
2021-04-17 10:42:57 +02:00
import 'package:nc_photos/widget/my_app.dart';
2021-04-10 06:28:12 +02:00
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await app_init.init(app_init.InitIsolateType.main);
2021-04-10 06:28:12 +02:00
2022-01-17 11:59:40 +01:00
if (platform_k.isMobile) {
// reset orientation override just in case, see #59
2022-07-28 18:59:26 +02:00
unawaited(SystemChrome.setPreferredOrientations([]));
2022-01-17 11:59:40 +01:00
}
2022-07-09 07:59:09 +02:00
BlocOverrides.runZoned(
() => runApp(const MyApp()),
blocObserver: _BlocObserver(),
eventTransformer: sequential(),
);
}
class _BlocObserver extends BlocObserver {
@override
onChange(BlocBase bloc, Change change) {
super.onChange(bloc, change);
_log.finer("${bloc.runtimeType} $change");
}
static final _log = Logger("main._BlocObserver");
2021-04-10 06:28:12 +02:00
}