is_first_run

Creator: coderz1093

Last updated:

Add to Cart

Description:

is first run

is_first_run #
A simple package to check if it is the first time the app runs.
Internally it uses the shared_preferences plugin.
Getting Started #
To use this plugin, add is_first_run as a dependency in your pubspec.yaml file.
Usage #
Import is_first_run.dart:
import 'package:is_first_run/is_first_run.dart';
copied to clipboard
To check if this is the first time the app is run:
bool firstRun = await IsFirstRun.isFirstRun();
copied to clipboard
If it is the first call of this method since installing the app, the method will return true for as long as the app keeps running.After a restart of the app it returns false.
There is also a method that allows you to check if it is the first time you call it:
bool firstCall = await IsFirstRun.isFirstCall();
copied to clipboard
Calling this function for the first time after installing the app returns true, after that every function call returns false.
You can reset the plugin by calling
await IsFirstRun.reset();
copied to clipboard
After calling reset(), calling isFirstRun() will return true as long as the app is running. After a restart, it will return false again. The first call of isFirstCall() will return true, subsequent calls will return false again.
Example #
The example is a simple page showing you the result of the function IsFirstRun.isFirstRun(). A button allows you to call IsFirstRun.isFirstRun() again, the reset button calls IsFirstRun.reset().
Maintainers #

Julian Aßmann

Pull requests are always very welcome.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.