パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.4

power_state

依存関係の挿入を備えたFlutterの状態管理ソリューション。簡単に状態を管理できます

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
102
いいね数
14
Pub ポイント
150

パッケージをインストール

flutter pub add power_state

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

PowerState は、依存関係の挿入を統合した Flutter の状態管理ソリューションであり、状態処理を簡素化します。開発者がアプリケーションの状態を効率的に管理できるようにし、クリーンでスケーラブルなコードを促進します。組み込みの依存関係注入により、ボイラープレートを減らし、テスト可能性を高めます。このパッケージはすべての主要プラットフォームをサポートしており、クロスプラットフォームアプリに最適です。直感的な API により、簡単にセットアップでき、ウィジェット間でのシームレスな状態更新が可能になります。

用途

  • クロスプラットフォームアプリ状態管理
  • Flutter アプリにおける依存性の挿入
  • 複雑な状態ロジックの簡素化
  • 状態を持つコンポーネントのテスト
  • スケーラブルなUIアーキテクチャの構築
  • 状態処理におけるボイラープレートの削減

主な機能

  • 組み込みの依存性注入
  • クロスプラットフォーム対応
  • 最小限のボイラープレート
  • 状態の簡単な更新
  • スケーラブルなアーキテクチャ
  • テストに適した設計

適している対象

  • 統合されたDIおよび状態管理を求める開発者
  • 大規模なFlutterアプリケーションを構築するチーム
  • 保守可能な状態ロジックを必要とするプロジェクト
  • Flutter初心者が状態管理を学ぶ
  • 複数のプラットフォームをターゲットにするアプリ

注意事項

  • 利用可能なドキュメントが限られている
  • 人気のある代替品と比べてコミュニティが小さい
  • 新しいユーザーには学習曲線が必要になる可能性があります
  • まだ本番環境で広く採用されていない
  • 限定的なサードパーティプラグイン互換性の可能性

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Power State is a lightweight and flexible state management library for Flutter apps. It provides a simple and easy-to-use API that helps you manage the state of your app in a clean and efficient way. With Power State, you can easily manage your app's state and update your UI in real-time.

Usage

Step:1 Create a PowerController

Create a controller class that extends PowerController. This controller class will hold your application's state and provide methods to manipulate it.

Here's an example CounterController class:

import 'package:power_state/power_state.dart';

class CounterController extends PowerController {
  int count = 1;

  increment() {
    count++;
    notifyListeners();
  }
}

Step:2 Store controller

Instantiate your controller class using PowerVault.put() method:

final CounterController controller = PowerVault.put(CounterController());

Step:3 Use PowerBuilder and PowerSelector to access your state

Use PowerBuilder to listen for changes to your state and rebuild your UI. Use PowerSelector to select a specific value from your state and rebuild only when that value changes.:

PowerBuilder<CounterController>(
  builder: (countController) {
    return Text(countController.count.toString());
  },
),

PowerSelector<CounterController>(
  selector: () => controller.selectorValue,
  builder: (countController) {
    return Text(countController.selectorValue.toString());
  },
),

Step:4 Update your state

Update your state by calling methods on your controller and calling notifyListeners() to rebuild your UI.

controller.increment();
controller.update();

You can find a Controller that is being used by another page and redirect you to it.

final CounterController countController = PowerVault.find();

Deleting a controller

If you no longer need a controller, you can delete it from PowerVault using the PowerVault.delete() method. Here's an example of deleting the CounterController:

PowerVault.delete<CounterController>();

Deleting all controller

If you no longer need controllerr, you can delete it from PowerVault using the PowerVault.clear() method. Here's an example of clear controllers:

PowerVault.clear();

Check out the example app to see Power State in action.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。