Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hoc081098/did_change_dependencies
Return a Stream that emits null and done event when didChangeDependencies is called for the first time.
https://github.com/hoc081098/did_change_dependencies
dart-streams did-change-dependencies flutter-rx flutter-rxdart flutter-stream flutter-streams rxdart rxdart-bloc rxdart-debug-operator rxdart-ext rxdart-extension rxdart-extensions rxdart-flutter rxdart-helper
Last synced: 23 days ago
JSON representation
Return a Stream that emits null and done event when didChangeDependencies is called for the first time.
- Host: GitHub
- URL: https://github.com/hoc081098/did_change_dependencies
- Owner: hoc081098
- License: mit
- Created: 2021-05-07T04:26:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-12T21:02:53.000Z (3 months ago)
- Last Synced: 2024-08-12T23:55:50.800Z (3 months ago)
- Topics: dart-streams, did-change-dependencies, flutter-rx, flutter-rxdart, flutter-stream, flutter-streams, rxdart, rxdart-bloc, rxdart-debug-operator, rxdart-ext, rxdart-extension, rxdart-extensions, rxdart-flutter, rxdart-helper
- Language: Dart
- Homepage: https://pub.dev/packages/did_change_dependencies
- Size: 4.3 MB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
# did_change_dependencies
## Author: [Petrus Nguyễn Thái Học](https://github.com/hoc081098)Return a `Stream` that emits null and done event when `State.didChangeDependencies` is called for the first time.
![Dart CI](https://github.com/hoc081098/did_change_dependencies/workflows/Flutter%20CI/badge.svg)
[![Pub](https://img.shields.io/pub/v/did_change_dependencies)](https://pub.dev/packages/did_change_dependencies)
[![Pub](https://img.shields.io/pub/v/did_change_dependencies?include_prereleases)](https://pub.dev/packages/did_change_dependencies)
[![codecov](https://codecov.io/gh/hoc081098/did_change_dependencies/branch/master/graph/badge.svg)](https://codecov.io/gh/hoc081098/did_change_dependencies)
[![GitHub](https://img.shields.io/github/license/hoc081098/did_change_dependencies?color=4EB1BA)](https://opensource.org/licenses/MIT)
[![Style](https://img.shields.io/badge/style-pedantic-40c4ff.svg)](https://github.com/dart-lang/pedantic)## Example
```dart
import 'dart:async';import 'package:did_change_dependencies/did_change_dependencies.dart';
import 'package:flutter/material.dart';
import 'package:rxdart_ext/rxdart_ext.dart';class Bloc {
Stream message$ = Stream.empty(); // just demo
}class MyPage extends StatefulWidget {
const MyPage({Key? key}) : super(key: key);@override
_MyPageState createState() => _MyPageState();
}class _MyPageState extends State with DidChangeDependenciesStream {
final bloc = Bloc();
final subscriptions = >[];@override
void initState() {
super.initState();final handle = (String msg) {
// safe to access ScaffoldMessengerState.
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(msg)),
);
};
subscriptions <<
didChangeDependencies$
.exhaustMap((value) => bloc.message$)
.listen(handle);subscriptions <<
didChangeDependencies$.listen((event) {
// do something when `didChangeDependencies` is called for the first time.
});
}@override
void dispose() {
super.dispose();
subscriptions.forEach((s) => s.cancel());
}@override
Widget build(BuildContext context) {
return Container();
}
}extension _ListExt on List {
void operator <<(T t) => add(t);
}
```