Is RX the same as redux

31 views
Skip to first unread message

ibrahim shehu ibrahim

unread,
Nov 22, 2018, 1:52:58 PM11/22/18
to Flutter Dev
Please I'm new to flutter and i see Rx and redux in some tutuorial videos please are they thesame

Steven McDowall

unread,
Nov 22, 2018, 1:55:38 PM11/22/18
to ibrahim shehu ibrahim, Flutter Dev

No -- they are not in any way the same.

https://rxjs-dev.firebaseapp.com - Although for Javascript the ideas are the same.

https://redux.js.org -- State management (think Scoped Model)



> On Nov 22, 2018, at 1:52 PM, ibrahim shehu ibrahim <ibrahims...@gmail.com> wrote:
>
> Please I'm new to flutter and i see Rx and redux in some tutuorial videos please are they thesame
>
> --
> You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Francesco Jo

unread,
Nov 22, 2018, 10:59:30 PM11/22/18
to Flutter Dev
Redux is more related to State management:
  
  i.e.) " a number displaying textview's content was changed from '1' to '100' " 

What Redux does in this scenario is, it signals the "number displaying textview" that the content currently displaying(rendering) is no longer valid. Redux itself does not know the details (how the number is changed / is the 'view' displays 'only number' / etc.)



Rx is more related to "Flow" of events - normally the flow represents timeline.

  i.e.) "user consecutively tapped screen 7 times"

What Rx does in this scenario is, it emits(delivers) the each tap event to its observers(subscribers). Moreover, with powerful rx operators, we can implement something related about "time/times" more easily.

Consider about a scenario - "A button should be disabled for some seconds after it pressed, to prevent rapid tapping". It could be described as below(pseudocode):


RxView.bindToView(myButton)
  .throttleFirst(5, TimeUnit.SECONDS
  .subscribe({ clickEvent -> 
    showMessage "${myButton} was tapped!"
  })


Hope it helps.
Reply all
Reply to author
Forward
0 new messages