is_first_run_plus 1.2.1 copy "is_first_run_plus: ^1.2.1" to clipboard
is_first_run_plus: ^1.2.1 copied to clipboard

A simple package to check if it is the first time the app runs.

is_first_run_plus #

This is a fork of Julian Aßmann's package https://github.com/JulianAssmann/flutter_is_first_run.

A simple package to check if it is the first time the app runs.

Internally it uses shared_preferences hive_flutter and package_info_plus plugins.

Getting Started #

To use this plugin, add is_first_run_plus as a dependency in your pubspec.yaml file.

Usage #

import is_first_run_plus.dart:

import 'package:is_first_run_plus/is_first_run_plus.dart';

To check if this is the first time the app is run:

bool firstRun = await IsFirstRun.isFirstRun();

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();

Calling this function for the first time after installing the app returns true, after that every function call returns false.

You can do the same calls with a build number parameter if you are interested in whether this is the first time using the app since a particular version:

bool firstCallSinceBuild66 = await IsFirstRun.isFirstCallSince(build: 66);
bool firstRunSinceBuild66 = await IsFirstRun.isFirstRunSince(build: 66);

You can reset the plugin by calling

await IsFirstRun.reset();

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 #

Pull requests are always very welcome.

2
likes
140
points
270
downloads

Publisher

unverified uploader

Weekly Downloads

A simple package to check if it is the first time the app runs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, hive_flutter, package_info_plus, shared_preferences

More

Packages that depend on is_first_run_plus