A Flutter EventBus using RxDart

Overview

FlutterRxBus

A Flutter EventBus using RxDart

Pub Package Pub Package

GitHub | Pub |

Usage

1. Add to pubspec.yaml

  rxbus: latest version

2. Define Event

Any Dart class or List or any Data can be used as an event.

class ChangeTitleEvent {
  String title;

  ChangeTitleEvent(this.title);
}

3. Register RxBus

Register RxBus

import 'package:rxbus/rx_bus.dart';

RxBus.singleton.register<ChangeTitleEvent>().listen((event) {
      ···//do something
    print(event.title);
    });

4. Send Event

Register listeners for specific events:

 RxBus.singleton.post(ChangeTitleEvent("Changed by event"));

5. Dispose RxBus

  @override
  void dispose() {
    RxBus.destroy();
    super.dispose();
  }

License

The MIT License (MIT)

You might also like...

This is the UI of Furniture App made using Flutter SDK. The original design was made by someone else in dribble and I tried to create the screens of that UI using Flutter

This is the UI of Furniture App made using Flutter SDK. The original design was made by someone else in dribble and I tried to create the screens of that UI using Flutter

Furniture App - Responsive Flutter UI Watch it on YouTube Responsive UI Fetch Data From API Custom Loading Indicator Packages we are using: flutter_sv

Dec 3, 2022

A News App in Flutter using the newsapi.org API and using Bloc.

A News App in Flutter using the newsapi.org API and using Bloc.

flutter_newsapp A News App using API from newsapi.org and using Bloc. Working ⚡ Screenshots == ⚡ video Before Running Replace the API_KEY in lib/r

Dec 9, 2022

A simple PokeDex App with Modern UI created using Flutter and Dart and using API from PokeApi.

A simple PokeDex App with Modern UI created using Flutter and Dart and using API from PokeApi.

FlutterDex FlutterDex A simple PokeDex App created using Flutter and Dart and using API from PokeApi. UI Design inspired by : Home Screen Pokedex iOS

Jan 1, 2023

A simple flutter application using #clean_architecture to generate random quotes using from #api

flutter_random_quotes_app_wth_clean_architecture A new Flutter project. Getting Started Project Structure ├── assets | ├── images | ├── 1x

Oct 4, 2022

Flutter Github Following Application, Using Flutter Provider and Flutter HTTP to get data from Github API.

Flutter Github Following Application, Using Flutter Provider and Flutter HTTP to get data from Github API.

Flutter Github Following Application Watch it on Youtube Previous Designs Checkout my Youtube channel Installation Please remember, after cloning this

Dec 23, 2022

Challenge yourself every weekend with flutter. Join me to implement challenging UI & digital designs using Flutter.

Challenge yourself every weekend with flutter. Join me to implement challenging UI & digital designs using Flutter.

Weekend With Flutter This is my new challenge. Every weekend, I want to implement challenging UI & digital designs using Flutter. you can join me with

Feb 24, 2022

Flutter Viral News App using : Flutter + Rest Api + Bloc / Cubit

Flutter Viral News App using : Flutter + Rest Api + Bloc / Cubit

Intro Viral News App on Flutter. The tech used: Flutter widgets + Flutter Bloc / Cubit + Rest Api Check the screenshot : P.S Make sure to upgrade your

Nov 2, 2022

Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.

Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.

Official Flutter packages for Stream Chat Quick Links Register to get an API key for Stream Chat Flutter Chat SDK Tutorial Chat UI Kit Sample apps Thi

Dec 25, 2022

Flutter jobs borad app created using flutter

Flutter jobs borad app created using flutter

Flutter Jobs App note : the app is not working now because of some changes in the web site and i will work on it soon(∞∞) but you can still benfit fro

Dec 21, 2022
Comments
  • Dependency Mismatch Error

    Dependency Mismatch Error

      flutter:
        sdk: flutter
      flutter_bloc: ^0.19.0
      chopper: ^2.4.2
      built_value: ^6.7.0
      kiwi: ^0.2.0
      shared_preferences: ^0.5.3+4
      url_launcher: ^5.1.1
      event_bus: ^1.1.0
      flutter_sms: ^1.0.1
      rxdart: ^0.22.0
      rxbus: ^0.0.2`
    

    After adding rxbus I am getting the following error:

    Running "flutter pub get" in example_project...                    
    
    Because example_project depends on rxbus ^0.0.2 which depends 
    on rxdart ^0.20.0, rxdart ^0.20.0 is required.
    So, because example_project depends on rxdart ^0.22.0, 
    version solving failed.
    pub get failed (1)
    Process finished with exit code 1
    
    I guess you need to upgrade your RxDart version to latest.
    
    
    
    
    
    opened by nawinkhatiwada 1
  • Concurrent modification during iteration

    Concurrent modification during iteration

    static void destroy({tag}) { _list.forEach((rxBus) { if (tag != null && tag != _DEFAULT_IDENTIFIER && rxBus.tag == tag) { rxBus.subject.close(); _list.remove(rxBus); } else if ((tag == null || tag == _DEFAULT_IDENTIFIER) && rxBus.tag == _DEFAULT_IDENTIFIER) { rxBus.subject.close(); _list.remove(rxBus); } }); } 在进行迭代循环时试图删除list中内容,导致异常抛出,建议的修改方案如: ///事件关闭 static void destroy({tag}) { var toRemove = []; _list.forEach((rxBus) { if (tag != null && tag != _DEFAULT_IDENTIFIER && rxBus.tag == tag) { rxBus.subject.close(); toRemove.add(rxBus); } else if ((tag == null || tag == _DEFAULT_IDENTIFIER) && rxBus.tag == _DEFAULT_IDENTIFIER) { rxBus.subject.close(); toRemove.add(rxBus); } }); toRemove.forEach((rxBus) { _list.remove(rxBus); }); }

    opened by applecyg 2
Owner
www.apkdv.com
null
🚀 User management app built in flutter using clean architecture, MVVM, get it, dio, RxDart, bloc, cubit, getX and provider

?? Go Rest app In this project, we are going to build a user management app using Flutter. We have used the Go REST API to make HTTP request methods.

Sina 99 Aug 14, 2023
A simple application connected with API (The Movie Database), related to movies. Application created using BLoC pattern and RxDart

MovieApp I will not hide that this is the most difficult application I have done so far (and I am still working on new features). It looks like this (

Adam Dybcio 9 Oct 28, 2022
181011450390-FLUTTER-CHALLENGE - Example GitHub Search app built in Flutter & RxDart

Example GitHub Search app built in Flutter & RxDart Simple app using the Flutter

null 1 Jan 3, 2022
A starter kit for beginner learns with Bloc pattern, RxDart, sqflite, Fluro and Dio to architect a flutter project. This starter kit build an App Store app as a example

Flutter Starter Kit - App Store Example A starter kit for beginner learns with Bloc pattern, RxDart, sqflite, Fluro and Dio to architect a flutter pro

kw101 678 Jan 8, 2023
Clonning TIX ID with flutter with BLoC Pattern and RxDart

tix_app Cloning TIX ID in Flutter (Currently design only, next i will grab the movies from IMDB api for free) Feature Movies Movies Detail Ticket List

Anggit Prayogo 23 Aug 23, 2021
🌀 Shared preferences with RxDart Stream observation

?? Shared preferences with RxDart Stream observation ⚡️ Reactive shared preferences for Flutter ??Reactive stream wrapper around SharedPreferences ?? Lightweight and easy-to-use ?? A reactive key-value store for Flutter projects. Like shared_preferences, but with Streams ?? Rx Shared Preferences for Flutter ?? rx_shared_preferences ?? rx_shared_preference ?? Reactive SharedPreferences for Flutter ?? A stream based wrapper over shared_preferences, allowing reactive key-value storage.

Petrus Nguyễn Thái Học 36 Nov 4, 2022
A simple state management solution that combine the power of inherited widget and rxdart

Inherited RxDart is a state management library that combine the power of InheritedWidget and RxDart, a simple and elegant state management solution for apps of any scale

Nguyễn Ngọc Phước 14 Oct 26, 2022
This repository contains Collection of UIs made using Flutter. Original Design of all the UIs were created by someone else. I tried to recreate those UIs using Flutter

Flutter-UIs-Collection This repository contains Collection of UIs made using Flutter. Original Design of all the UIs were created by someone else. I t

Mohak Gupta 45 Nov 26, 2022
Recipes app in flutter using API to get data. Amazing Recipes app UI in Flutter using dart with simple widgets.

Food Recipe App In Flutter Using API'S Recipe App in Flutter Subscribe Our YouTube Channel. Visit Website Demo OutPut Images ## ?? Links Getting Start

Habib ullah 2 Dec 26, 2022