main function

void main()

Entry point for the application.

This method initializes the app, sets up localization, retrieves the user's login state, and configures system UI settings.

Implementation

void main() async {
  // Ensures that Flutter framework bindings are initialized before performing any actions.
  WidgetsFlutterBinding.ensureInitialized();
  await EasyLocalization.ensureInitialized();

  // Fetch the currently logged-in user, if any, from local storage (shared preferences).
  User? user = await UserUtils().getLoggedInUser();

  // Set system bar styles for enhanced UI appearance on Android.
  UIUtils.makeSystemBarTransparent();

  runApp(
    EasyLocalization(
      supportedLocales: const [
        Locale('en'), // English language support.
        Locale('de'), // German language support.
      ],
      path: 'assets/lang', // Path to localization asset files.
      child: MyApp(user: user), // Passes the logged-in user to the app.
    ),
  );
}