comm_utils 0.1.1 copy "comm_utils: ^0.1.1" to clipboard
comm_utils: ^0.1.1 copied to clipboard

This is a fullter tool class, which encapsulates various tool processing classes.

example/lib/main.dart

import 'package:comm_utils/app_config.dart';
import 'package:comm_utils/export_khttp.dart';
import 'package:comm_utils/module/language/klanguage_utils.dart';
import 'package:comm_utils/module/language/language_vo.dart';
import 'package:example/http/api_repository.dart';
import 'package:example/http/throw_handler.dart';
import 'package:example/init_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitDown,
    DeviceOrientation.portraitUp,
  ]);

  /// 初始化全局配置
  await AppConfig.init(() {
    ///初始化网络
    var config = KHttpConfig("https://consumer.maxspos.com", ThrowHandler());
    var httpClient = KHttpServer(config);

    ///创建数据仓库
    Get.lazyPut(fenix: true, () => ApiRepository(httpClient));

    ///添加多语言
    KLanguageUtils.get.initLanguage(
        [LanguageVo.toSystem(), LanguageVo.toEn(), LanguageVo.toCN()]);
  });

  ///会有警告,先去掉
  // runZonedGuarded<Future<void>>(() async {
  //   var onError = FlutterError.onError; //先将 onerror 保存起来
  //   FlutterError.onError = (FlutterErrorDetails details) {
  //     onError?.call(details); //调用默认的onError
  //   };
  runApp(const InitPage());
  // }, (error, stack) => KLog.e(error.toString()));
}
0
likes
0
points
157
downloads

Publisher

unverified uploader

Weekly Downloads

This is a fullter tool class, which encapsulates various tool processing classes.

Homepage

License

unknown (license)

Dependencies

cached_network_image, cookie_jar, crypto, decimal, dio, dio_cookie_manager, dropdown_button2, easy_refresh, flutter, flutter_easyloading, flutter_screenutil, get, intl, json_annotation, logger, permission_handler, pretty_dio_logger, rational, shared_preferences

More

Packages that depend on comm_utils