GithubHelp home page GithubHelp logo

smart_events_handler's Introduction

Smart Events Handler

A Flutter package designed to simplify event handling across your entire app. smart_events_handler allows you to manage and respond to events in a decoupled and efficient manner, making your code cleaner and more maintainable.

Features

  • Type-Safe Event Handling: Work with any event type with compile-time checks.
  • Flexible Event Listening: Easily listen for and handle specific events anywhere in your widget tree.
  • Automatic Event Disposal: Events are automatically cleaned up to prevent memory leaks.
  • Support for Multiple Event Types: Handle different types of events with the same handler, allowing for flexible event management strategies.

Installation

Add smart_events_handler to your pubspec.yaml file:

dependencies:
  smart_events_handler: ^1.0.0

Then run flutter pub get to install the package.

Usage

Setting up the Event Gatherer

Wrap your app (or a part of your app) with SmartEventGathererProvider to start gathering events:

SmartEventGathererProvider<MyEvent>(
  eventStream: myEventStream,
  child: MyApp(),
);

Handling Events

Use SmartEventHandler to handle specific events:

SmartEventHandler<MySpecificEvent, GathererEvent>(
  onSmartEventReceived: (event) {
    // Handle the event
  },
  child: MyWidget(),
);

Dispatching Events

To dispatch events, use your event stream:

myEventStreamController.add(MySpecificEvent());

Contributing

Contributions are welcome! Please feel free to submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

smart_events_handler's People

Contributors

aliaksei-liavonik avatar bartekpacia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.