init static method

Future<void> init({
  1. required dynamic configure(
    1. GetIt,
    2. Map<String, String> env
    ),
  2. dynamic finalize(
    1. GetIt,
    2. Map<String, String>
    )?,
  3. bool loadEnv = true,
  4. String envFile = '.env',
})

Implementation

static Future<void> init({
  required Function(GetIt, Map<String, String> env) configure,
  Function(GetIt, Map<String, String>)? finalize,
  bool loadEnv = true,
  String envFile = '.env',
}) async {
  if (loadEnv) await dotenv.load(fileName: envFile);
  configure(di, dotenv.env);

  await di.allReady(
    timeout: const Duration(seconds: 5),
  );

  if (finalize != null) finalize(di, dotenv.env);
}