common tool classes of flutter, including Http network request encapsulation and common tool classes

1、Http network request

http demo

   dio: ^4.0.6
   comm_utils: ^0.0.1

/// Initialize utils
await XUtils.get.init(debug: kDebugMode);

///Initialize network
var config = HttpConfig("https://xxx", ThrowHandler());
var httpClient = HttpServer(config);

///Create data warehouse
Get.lazyPut(fenix: true, () => ApiRepository(httpClient));

2、Common tools

  • color_utils: color tool class, main string to color
  • date_utils: date tool class, obtains the date and time, and converts data between different times.
  • encrypt_utils: encryption and decryption tools, mainly md5 encryption, base64 encryption and decryption, XOR encryption and decryption, etc.
  • json_utils: json conversion tool class, mainly responsible for list,map, object and json conversion, etc.
  • money_utils: currency symbol tool class, mainly for currency conversion and formatting
  • num_utils: Num Num format tool class, mainly responsible for num related processing and conversion operations
  • random_utils: random number tool class, which mainly generates strings and numbers randomly
  • regex_utils: Regular expression tool class, mainly for verification of telephone, ID card, email, IP, network, etc
  • sp_utils: sp sp storage tool class. It is suitable for storing lightweight data. We do not recommend that you store long json strings.
  • status_bar_utils: status bar tool class
  • system_utils: system tools, copy content to the clipboard, pop up and close the soft keyboard, clear data, etc.
  • text_utils: text tool class, which mainly deals with string indentation
  • timer_utils: timer, countdown timer tool, set the total countdown time, interval, etc.
  • xlog: log output tool class


  • k_double:double extension, including the conversion of kilometers and meters
  • k_object:object extension, which determines whether the object is empty or not.
  • k_widget:widget extension, including click event, click anti-duplicate, double-click exit, whether the control is displayed