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

GitHub リポジトリfelangel/inherited_stream

inherited_stream

ストリーム用の継承ウィジェットで、ストリームがデータを発行するときに依存関係を更新します。

inherited_stream のプロジェクト画像
スター
23
フォーク
2
最終プッシュ(UTC)
2025/03/27
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

Inherited Stream

Pub build coverage License: MIT

An InheritedWidget for Streams, which updates its dependencies when the Stream emits.

Usage

Create an InheritedStream
class ProgressModel extends InheritedStream<ValueStream<double>> {
  const ProgressModel({
    Key? key,
    required ValueStream<double> stream,
    required Widget child,
  }) : super(key: key, stream: stream, child: child);

  static double of(BuildContext context) {
    return context
        .dependOnInheritedWidgetOfExactType<ProgressModel>()!
        .stream
        .value!;
  }
}
Insert into the Widget Tree
class _MyState extends State<MyPage> {
  final _subject = BehaviorSubject<double>.seeded(0.0);

  @override
  void dispose() {
    _subject.close();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ProgressModel(
        stream: _subject.stream,
        child: Progress(),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => _subject.add(Random.nextDouble()),
      ),
    );
  }
}
Register Dependant(s)
class Progress extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CircularProgressIndicator(value: ProgressModel.of(context));
  }
}
Felix Angelov GitHub avatar
GitHub 作者

Felix Angelov ↗

software engineer by day, software engineer by night.

言語C++CMakeDartHTMLCSwiftKotlinObjective-C

使用している依存関係

依存関係一覧 2 件

  • flutter{"sdk":"flutter"}
  • flutter_test開発用{"sdk":"flutter"}

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗