isFirstCall static method

Future<bool> isFirstCall()

Returns true if this is the first time this function has been called since installing the app, otherwise false.

In contrast to IsFirstRun.isFirstRun(), this method only returns true on the first call after installing the app, while IsFirstRun.isFirstRun() continues to return true as long as the app is running after calling it the first time after installing it.

Implementation

static Future<bool> isFirstCall() async {
  SharedPreferences prefs = await SharedPreferences.getInstance();
  bool firstCall;
  try {
    firstCall = prefs.getBool(_firstCallSettingsKey) ?? true;
  } on Exception {
    firstCall = true;
  }
  await prefs.setBool(_firstCallSettingsKey, false);

  return firstCall;
}