Skip to content

State management library to implement the BLoC design pattern on Android.

License

Notifications You must be signed in to change notification settings

tgloureiro/android-bloc

Repository files navigation

Build and Test License Badge Tag Badge

Android-BLoC

State management library to implement the BLoC design pattern on Android.

This package is inspired by the concept of BLoC proposed by Paolo Soares on DartConf 2018 and by Felix Angelov's Flutter Bloc State Management Library.

Installation

  1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. Add the dependency on the app's build.gradle. Set $lib_version_tag with the latest tag version, ex.:('0.1.2'). Tag Badge
dependencies {
	...
	implementation 'com.github.tgloureiro:android-bloc:$lib_version_tag'
}

How BLoC works as a design pattern:

Main Concept

A view can connect to multiple BloCs

View connected to multiple BloCs

A BLoC can connect to multiple BloCs

Bloc connected to multiple BloCs

How Android BLoC works:

Usage in Android

Using Android's ViewModel as a BLoC provider

ViewModel as BLoC Provider

License

MIT License

Copyright (c) 2021  Tiago Loureiro

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.

About

State management library to implement the BLoC design pattern on Android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages