搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.0

is_first_run

一個簡單的套件,用於檢查應用程式是否為首次執行。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2460
喜歡數
92
Pub 分數
160

安裝套件

flutter pub add is_first_run

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

is_first_run 套件提供了一種簡單的方法來判斷應用程式是否為首次在裝置上啟動。它使用共用偏好設定來儲存一個旗標,以指示應用程式的執行狀態,確保跨會話的可靠檢測。非常適合用於初始化設定流程、顯示引導畫面或觸發首次使用者動作。此套件輕量且與所有主要 Flutter 平台相容,包括行動裝置、網頁及桌面端。無需複雜設定,可順暢整合至現有專案中。

適用情境

  • 引導螢幕顯示
  • 首次使用者設定
  • 初始數據初始化
  • 歡迎訊息傳遞
  • 功能切換激活

主要特色

  • 簡單 API
  • 持久化狀態儲存
  • 跨平台支援
  • 無外部依賴
  • 輕鬆整合

適合對象

  • 新應用發佈
  • 使用者引導流程
  • 初始設定任務
  • 輕量級狀態追蹤
  • 需要首次執行邏輯的應用程式

使用建議

  • 依賴於共享偏好
  • 不會自動重設
  • 可能需要手動清除
  • 僅限首輪運行檢測
  • 無內建分析功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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';

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 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.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案