All Projects â†’ hoc081098 â†’ Flutter_validation_login_form_bloc_pattern_rxdart

hoc081098 / Flutter_validation_login_form_bloc_pattern_rxdart

Licence: mit
[Functional reactive programming (FRP)]💧 💧 💧 [Pure RxDart] Validation login form by using the BLoC pattern with RxDart - A new Flutter project featuring a faked authentication interface to demonstrate validation. Implemented with BloC pattern.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Flutter validation login form bloc pattern rxdart

flutter-form-with-validation-BLOC
This form and validation functions are created by using the BLOC pattern with RxDart instead of using StatefulWidget
Stars: ✭ 63 (+40%)
Mutual labels:  reactivex, reactive-streams, reactive-programming, rx, flutter-apps
Rx.Http
A reactive way to make HTTP Request in .NET Core 🚀
Stars: ✭ 62 (+37.78%)
Mutual labels:  reactivex, reactive-streams, reactive-programming, rx
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (+262.22%)
Mutual labels:  reactive-programming, reactive-streams, reactivex
Dynamicdata
Reactive collections based on Rx.Net
Stars: ✭ 1,083 (+2306.67%)
Mutual labels:  reactive-programming, rx, reactivex
Rxdownloader
- Reactive Extension Library for Android to download files
Stars: ✭ 40 (-11.11%)
Mutual labels:  reactive-programming, reactive-streams, reactivex
Monix
Asynchronous, Reactive Programming for Scala and Scala.js.
Stars: ✭ 1,819 (+3942.22%)
Mutual labels:  reactive-programming, reactive-streams, reactivex
Pharmacist
Builds observables from events.
Stars: ✭ 221 (+391.11%)
Mutual labels:  reactivex, reactive-programming, rx
mongo-images
Ever wonder how you can create a full stack reactive application that also saves images? Well look no further! We've got Spring Webflux, Reactive Mongo Streams with GridFS, and Angular5!
Stars: ✭ 12 (-73.33%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
observable-playground
Know your Observables before deploying to production
Stars: ✭ 96 (+113.33%)
Mutual labels:  reactive-streams, reactive-programming
Reactiveswift
Streams of values over time
Stars: ✭ 2,812 (+6148.89%)
Mutual labels:  reactive-programming, reactive-streams
Toy Rx
A tiny implementation of RxJS that actually works, for learning
Stars: ✭ 290 (+544.44%)
Mutual labels:  reactive-programming, rx
WebsocketClientLite.PCL
websocket Client Lite PCL - Xaramrin
Stars: ✭ 22 (-51.11%)
Mutual labels:  reactivex, rx
reactor-go
A golang implementation for reactive-streams.
Stars: ✭ 48 (+6.67%)
Mutual labels:  reactivex, reactive-streams
Awesome Flutter
An awesome list that curates the best Flutter libraries, tools, tutorials, articles and more.
Stars: ✭ 38,582 (+85637.78%)
Mutual labels:  flutter-apps, reactive-programming
RxJava-Codelab
Codelab project for demonstration of RxJava features
Stars: ✭ 44 (-2.22%)
Mutual labels:  reactivex, reactive-programming
Awesome Rxjs
A collection of awesome RxJS resources
Stars: ✭ 314 (+597.78%)
Mutual labels:  reactive-programming, reactivex
Rxjava2 Jdbc
RxJava2 integration with JDBC including Non-blocking Connection Pools
Stars: ✭ 360 (+700%)
Mutual labels:  reactive-programming, reactive-streams
rxkotlin-jdbc
Fluent RxJava JDBC extension functions for Kotlin
Stars: ✭ 27 (-40%)
Mutual labels:  reactivex, rx
Entwine
Testing tools and utilities for Apple's Combine framework.
Stars: ✭ 306 (+580%)
Mutual labels:  reactive-programming, reactive-streams
Rpd
👌 A Minimal Engine for creating Node-Based Visual Programming User Interfaces
Stars: ✭ 370 (+722.22%)
Mutual labels:  reactive-programming, reactive-streams

flutter_validation_login_form_BLoC_pattern_RxDart

Sample Mobile Validation using rxdart and BLoC pattern

Screenshot

Video demo

Cannot load image

BLoC

1. Create stream controllers to receive input: email, password, submit

// Stream controllers
final emailS = BehaviorSubject.seeded('');
final passwordS = BehaviorSubject.seeded('');
final isLoadingS = BehaviorSubject.seeded(false);
final submitLoginS = StreamController<void>();
final subjects = [emailS, passwordS, isLoadingS, submitLoginS];

2. Map email text and password text to set of errors

// Email error and password error stream
final emailError$ = emailS.map(validator.validateEmail).distinct().share();
 
final passwordError$ =
    passwordS.map(validator.validatePassword).distinct().share();

3. Combine email errors stream and password errors stream to valid stream

// Submit stream
final submit$ = submitLoginS.stream
    .throttleTime(const Duration(milliseconds: 500))
    .withLatestFrom<bool, bool>(
      Rx.combineLatest<Set<ValidationError>, bool>(
        [emailError$, passwordError$],
        (listOfSets) => listOfSets.every((errorsSet) => errorsSet.isEmpty),
      ),
      (_, isValid) => isValid,
    )
    .share();

4. Perform login effect based on submit stream

// Message stream
final message$ = Rx.merge(
  [
    submit$
        .where((isValid) => isValid)
        .withLatestFrom2(
          emailS,
          passwordS,
          (_, email, password) => Credential(
            email: email,
            password: password,
          ),
        )
        .exhaustMap(
          (credential) => interactor.performLogin(
            credential,
            isLoadingS,
          ),
        ),
    submit$
        .where((isValid) => !isValid)
        .map((_) => const InvalidInformationMessage()),
  ],
).publish();

That's all :)

Getting Started

For help getting started with Flutter, view our online documentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].