onFirstTimeLaunched function

bool onFirstTimeLaunched({
  1. required String key,
  2. void onFirstTimeLaunched()?,
  3. void onNormalLaunch()?,
})

Description

  • Execute some code if this is the first time the user has launched your app.

Parameters

  • key - The key used for retrieving the information if the user has or has not launched this app yet.

  • onFirstTimeLaunched - Execute some code when the user launches this app for the first time.

  • onNormalLaunch - Execute some code if the user has already launched your app in the past.

Implementation

bool onFirstTimeLaunched({
  required String key,
  void Function()? onFirstTimeLaunched,
  void Function()? onNormalLaunch,
}) {
  if (getBool(key) ?? false) {
    onFirstTimeLaunched?.call();
    return true;
  } else {
    onNormalLaunch?.call();
  }

  return false;
}