ensureInitialized static method

Infospect ensureInitialized({
  1. int maxCallsCount = 1000,
  2. GlobalKey<NavigatorState>? navigatorKey,
  3. bool logAppLaunch = false,
  4. void onShareAllNetworkCalls(
    1. String path
    )?,
  5. void onShareAllLogs(
    1. String path
    )?,
})

Ensures the Infospect instance is initialized. If it's not initialized, it will initialize it with the provided arguments.

Returns the initialized instance of Infospect.

Implementation

static Infospect ensureInitialized({
  int maxCallsCount = 1000,
  GlobalKey<NavigatorState>? navigatorKey,
  bool logAppLaunch = false,
  void Function(String path)? onShareAllNetworkCalls,
  void Function(String path)? onShareAllLogs,
}) {
  if (Infospect._instance == null) {
    Infospect._(
      maxCallsCount: maxCallsCount,
      navigatorKey: navigatorKey,
      logAppLaunch: logAppLaunch,
      onShareAllLogs: onShareAllLogs,
      onShareAllNetworkCalls: onShareAllNetworkCalls,
    );
  }
  return Infospect.instance;
}