app_service 1.0.2 copy "app_service: ^1.0.2" to clipboard
app_service: ^1.0.2 copied to clipboard

App service based on GetX library.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_it/get_it.dart';
import 'package:app_service/app_service.dart';

import 'app/injections.dart';

import 'app/router.dart';
import 'modules/home/home_view.dart';
import 'modules/home/home_tr.dart';

void main() async {
  Get.testMode = false;
  GetitInjection.init();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  Future<void> onInit(BuildContext context) async {
    final appService = GetIt.instance.get<AppService>();
    await appService.init();
  }

  @override
  Widget build(BuildContext context) {
    final appService = GetIt.instance.get<AppService>();

    return GetMaterialApp(
      debugShowCheckedModeBanner: Get.testMode,
      title: switch (Get.locale?.languageCode) {
        'zh' => 'AppService 演示',
        'en' => 'AppService Demo',
        'fr' => 'AppService démonstration',
        'ja' => 'AppServiceデモ',
        'ko' => 'App 서비스 데모',
        'ar' => 'تطبيق AppService',
        _ => 'AppService Demo',
      },
      theme: appService.currentTheme,
      getPages: AppRoutes.routes,
      translations: Messages([
        AppServiceMessages().keys,
        HomeMessages().keys,
      ]),
      locale: const Locale('zh', 'CN'),
      fallbackLocale: const Locale('en', 'US'),
      home: const HomeView(),
      onInit: () async {
        await onInit(context);
      },
    );
  }
}
2
likes
150
pub points
65%
popularity

Publisher

unverified uploader

App service based on GetX library.

Documentation

API reference

License

MIT (LICENSE)

Dependencies

cupertino_icons, dash_flags, flex_color_scheme, flutter, flutter_svg, get, get_it, shared_preferences

More

Packages that depend on app_service