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

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

example/lib/main.dart

import 'package:comm_utils/comm_http.dart';
import 'package:comm_utils/xutils.dart';
import 'package:example/generated/l10n.dart';
import 'package:example/page/home_page.dart';
import 'package:example/http/api_repository.dart';
import 'package:example/http/throw_handler.dart';
import 'package:example/page_manager.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';

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

  /// 初始化utils
  await XUtils.get.init(debug: kDebugMode);

  ///初始化网络
  var config = HttpConfig("https://consumer.maxspos.com", ThrowHandler());
  var httpClient = HttpServer(config);

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

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      localizationsDelegates: const [
        S.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      locale: const Locale("en"),
      supportedLocales: S.delegate.supportedLocales,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      initialRoute: PageManger.home,
      getPages: PageManger.pages,
    );
  }
}
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

cookie_jar, crypto, decimal, dio, dio_cookie_manager, flutter, intl, json_annotation, logger, pretty_dio_logger, rational, shared_preferences

More

Packages that depend on comm_utils