main.dart 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import 'package:appflowy_backend/log.dart';
  2. import 'package:easy_localization/easy_localization.dart';
  3. import 'package:flutter/foundation.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:hotkey_manager/hotkey_manager.dart';
  6. import 'startup/launch_configuration.dart';
  7. import 'startup/startup.dart';
  8. import 'user/presentation/splash_screen.dart';
  9. import 'window/window.dart';
  10. class FlowyApp implements EntryPoint {
  11. @override
  12. Widget create(LaunchConfiguration config) {
  13. return SplashScreen(
  14. autoRegister: config.autoRegistrationSupported,
  15. );
  16. }
  17. }
  18. Future<void> main() async {
  19. WidgetsFlutterBinding.ensureInitialized();
  20. // Handle platform errors not caught by Flutter.
  21. // Reduces the likelihood of the app crashing, and logs the error.
  22. PlatformDispatcher.instance.onError = (error, stack) {
  23. Log.error('Uncaught platform error', error, stack);
  24. return true;
  25. };
  26. await EasyLocalization.ensureInitialized();
  27. await hotKeyManager.unregisterAll();
  28. await AppWindow.initialize();
  29. await FlowyRunner.run(FlowyApp());
  30. }