Search packages, repositories and app categories

Package detailsv1.0.2

livestream

LiveStream is a simple class which makes communication easy among different modules of your application.

30-day downloads
29
Likes
29
Pub points
40

Install package

flutter pub add livestream

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Livestream is a lightweight Flutter package designed to simplify communication between different parts of an application. It provides a straightforward way to broadcast and listen to events, making it ideal for state management and inter-module communication without the complexity of larger frameworks. The package is built around a simple publish-subscribe pattern, enabling efficient data flow across widgets, services, or screens. With minimal setup and no external dependencies, Livestream enhances modularity and responsiveness in Flutter apps.

Use cases

  • Real-time event broadcasting
  • Cross-widget communication
  • Simplifying state updates
  • Decoupling app modules
  • Handling user actions across screens
  • Streamlining plugin interactions

Key features

  • Simple publish-subscribe model
  • Minimal boilerplate
  • No external dependencies
  • Lightweight and fast
  • Easy integration with existing code
  • Supports typed events

Suitable for

  • Small to medium-sized Flutter apps
  • Developers seeking lightweight state management
  • Teams avoiding complex dependency injection
  • Apps needing quick event-driven communication
  • Prototyping rapid UI updates
  • Projects prioritizing simplicity over scalability

Considerations

  • Not suitable for large-scale state management
  • Limited to basic event handling
  • No built-in persistence or recovery
  • Best for temporary or transient data
  • May require manual cleanup in long-running apps
  • Not ideal for complex data synchronization

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

LiveStream - Dart

Pub Github Followers GitHub stars GitHub forks GitHub watchers Twitter Follow

LiveStream is a data holder class which can observe change of data in real-time and emit values too. Here's emitter subscriber pattern. It's developed in pure Dart.

⚡️ Getting Started

Add Dependency

Add below dependency in pubspec.yaml.

dependencies:
  livestream: ^1.0.2
Initialize LiveStream Instance

You can create instance as below.

  LiveStream liveStream = new LiveStream();
Subscribe to Stream / Add Observer

LiveStream event will be dispatched when data is changed. See below code to add observer / subscriber.

    liveStream.on("chat-message", (message) {
      print("Message Received: $message");
    });

Whenever data is emitted to chat-message channel/stream above block will be executed.

Emitting Events or Broadcasting

The main idea behind LiveStream is that you can send and receive any events you want, with any data you want. Any objects that can be encoded as JSON will do, and binary data is supported too. See code below.

  void send() {
      String message = "Hi there!";
      liveStream.emit("chat-message", message);
  }

🚀 Sample Usage

Sample code is available in /example directory.

🤝 Contribute

If you want to contribute to this library, you're always welcome! See Contributing Guidelines.

✉️ Contact

If you need any help, you can connect with me.

Visit:- shreyaspatil.dev

📃 License

MIT License

Copyright (c) 2020 Shreyas Patil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Categories

Source repository

Projects using this package

No data available yet.