Return a Stream that emits null and done event when didChangeDependencies is called for the first time.

Overview

did_change_dependencies

Author: Petrus Nguyễn Thái Học

Return a Stream that emits null and done event when State.didChangeDependencies is called for the first time.

Dart CI Pub Pub codecov GitHub Style

Example

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<String> message$ = Stream.empty(); // just demo
}

class MyPage extends StatefulWidget {
  const MyPage({Key? key}) : super(key: key);

  @override
  _MyPageState createState() => _MyPageState();
}

class _MyPageState extends State<MyPage> with DidChangeDependenciesStream {
  final bloc = Bloc();
  final subscriptions = <StreamSubscription<void>>[];

  @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<T> on List<T> {
  void operator <<(T t) => add(t);
}
Comments
Releases(1.0.0)
Owner
Petrus Nguyễn Thái Học
Functional & Reactive Programming - Rx Fan 🌰 RxDart - RxKotlin - RxSwift - rxjs 🌸 Android - iOS - Flutter - Node.js - Angular
Petrus Nguyễn Thái Học
An Event-based system, highly inspired by NodeJS's Event Emitter

An Event-based system, highly inspired by NodeJS's Event Emitter. This implementation uses generic types to allow for multiple data types, while still being intuitive.

JUST A SNIPER ツ 5 Dec 1, 2022
Z time ago - A simple Flutter z time ago package used to change date to time ago for english, arabic and kurdish languages

This package is used to get time duration from now and given time for kurdish, a

Zakarya Muhammad 2 May 19, 2022
A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released.

pinch_zoom A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released

Teun Kortekaas 36 Dec 30, 2022
TheMathU Similarity Index App will accept a mathematical problem as user input and return a list of similar problems that have memorandums.

Technologies MathU Similarity Index - Segmentation Cult The MathU Similarity Index App accepts a mathematical problem as user input and returns a list

COS 301 - 2022 7 Nov 2, 2022
Automatically generate profile picture with random first name and background color. But you can still provide pictures if you have them. As the default color, based on the name of the first letter. :fire: :fire: :fire:

FLUTTER PROFILE PICTURE Automatically generate profile picture with random first name and background color. But you can still provide pictures if you

Aditya Dharmawan Saputra 10 Dec 20, 2022
Return a result ErrorOr with either a value T or an error Object.

ErrorOr Return a result ErrorOr with either a value T or an error Object. Features Always return a value ErrorOr from an async function. Let the calle

Erlend 6 Nov 6, 2022
A group of overlapping round avatars are called face piles, a face pile is a series of overlapping avatar images that come and go as users join and leave a given group.

Flutter Face Pile A group of overlapping round avatars are called face piles. A face pile is a series of overlapping avatar images that come and go as

Amine Chamkh 3 Sep 22, 2022
Flutter package to hide out whole application or sections if you are not paid for the job done.

not_paid Worried about your payment? Using this package you can provide a non paid version of your app to the client that consistently starts fading o

hd-motion 11 Nov 30, 2021
Terminal styling done right - now for Dart!

vscode debug console windows terminal Console/Terminal text coloring and styling library for Dart 'Terminal string styling done right' I created this

Tim Maffett 4 Dec 10, 2022
Freela is a Flutter project that aims to connect people who want to work with jobs to be done.

Freela Freela is a Flutter project being developed at the university that aims to connect people who want to work with jobs to be done. Para Desenvolv

Gustavo Martins 4 Nov 1, 2022
Simple flutter app that shows the transfer of money between multiple customers. The project is done as a part of The Sparks Foundation Internship GRIPSEPTEMPER22

Sparks Bank ?? Table of Contents About Packages used ScreenShots from the app Demo vedio Contributors About Basic banking system created in Flutter ba

Heba Ashraf 5 Oct 14, 2022
A fully functional Movies Application built with Flutter. The application built with null safety and clean architecture, also uses OMDB API for fetching movies in the search item

Cinema DB Project Details This project uses null safety feature Project uses clean code architecture (Uncle Bob's Architecture) Project can run on bot

Dhruvam 2 Oct 1, 2022
A smartphone application called Easy Job goal is to make easier for businesses to find people who meet their standards as well as for job seekers to search for and choose from available positions .

Easy_Jobs 19SW54(MAD-Project) A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to ge

Muskan 2 Nov 6, 2022
just a flutter project called working_project that projects the project on the working.

Flutter & Firebase Realtime Apps This is a Shipper app that can be used as a shipper hooker using Flutter & Firebase. Go drawsql.app/c-5/diagrams/work

DokuroGitHub 0 Jan 1, 2022
State Persistence - Persist state across app launches. By default this library store state as a local JSON file called `data.json` in the applications data directory. Maintainer: @slightfoot

State Persistence Persist state across app launches. By default this library store state as a local JSON file called data.json in the applications dat

Flutter Community 70 Sep 28, 2022
Todo is an Simple Task Management App coded using Dart which is a peogramming language for Flutter SDK(2.5) supports Null Safety 📑🚩

Todo ?? ?? ?? Introduction Todo is an Simple Task Management App coded using Dart which is a peogramming language for Flutter SDK(2.5) supports Null S

navee-ramesh 6 Nov 5, 2022