init static method

Future<void> init({
  1. required String baseUrl,
  2. Directory? cacheDir,
  3. String cacheName = 'app_local_data',
  4. CacheMode baseCacheMode = CacheMode.ONLY_REQUEST,
  5. List<Interceptor>? interceptors,
  6. BaseOptions? baseOptions,
  7. bool systemLog = false,
  8. CheckNetWork? baseCheckNet,
  9. List<String>? ignoreCacheKeys,
  10. HiveCipher? encryptionCipher,
  11. Map<String, dynamic>? baseUrlEnv,
  12. int cacheInvalidationTime = 365 * 24 * 60 * 60 * 1000,
  13. double debugWindowWidth = 800,
  14. double debugWindowHeight = 600,
})

中文: baseUrl:服务端基础地址 cacheDir:缓存目录 cacheName:缓存文件 baseCacheMode:缓存策略 interceptors:自定义的拦截器 systemLog:是否使用系统自带的打印 baseCheckNet:网络检测,外部自行实现,网络不通不发起请求 ignoreCacheKeys:网络检测,外部自行实现 encryptionCipher:数据加密,不传默认即可 baseUrlEnv:多环境的基础服务地址 cacheInvalidationTime:缓存时效:默认1年 debugWindowWidth:调试窗口默认宽 debugWindowHeight:调试窗口默认高

English: baseUrl: basic address of the server cacheDir: Cache directory cacheName: Cache file baseCacheMode: caching strategy interceptors: Custom interceptors systemLog: Whether to use the system's own printing baseCheckNet: Network detection, implemented externally, no request is initiated when the network is blocked ignoreCacheKeys: Network detection, externally implemented encryptionCipher: Data encryption, you can only pass it by default baseUrlEnv: Basic service addresses for multiple environments cacheInvalidationTime: Cache aging: Default 1 year debugWindowWidth: Default width of debugging window debugWindowHeight: The debugging window defaults to high

Implementation

static Future<void> init(
    {required String baseUrl,
    Directory? cacheDir,
    String cacheName = 'app_local_data',
    CacheMode baseCacheMode = CacheMode.ONLY_REQUEST,
    List<Interceptor>? interceptors,
    BaseOptions? baseOptions,
    bool systemLog = false,
    CheckNetWork? baseCheckNet,
    List<String>? ignoreCacheKeys,
    HiveCipher? encryptionCipher,
    Map<String, dynamic>? baseUrlEnv,
    int cacheInvalidationTime = 365 * 24 * 60 * 60 * 1000,
    double debugWindowWidth = 800,
    double debugWindowHeight = 600}) async {
    WidgetsFlutterBinding.ensureInitialized();
   await I.initNet(
      baseUrl: baseUrl,
      cacheDir: cacheDir,
      cacheName: cacheName,
      baseCacheMode: baseCacheMode,
      interceptors: interceptors,
      baseOptions: baseOptions,
      systemLog: systemLog,
      baseCheckNet: baseCheckNet,
      ignoreCacheKeys: ignoreCacheKeys,
      encryptionCipher: encryptionCipher,
      baseUrlEnv: baseUrlEnv,
      cacheInvalidationTime: cacheInvalidationTime,
      debugWindowWidth: debugWindowWidth,
      debugWindowHeight: debugWindowHeight
    );
}