Skip to content

What is bind and transform in the context of Variable and Service? #290

Answered by Aylur
arzcbnh asked this question in Q&A
Discussion options

You must be logged in to vote

both of them return an instance of Binding which is basically a struct that holds

  • the emitter object that needs to be watched
  • its property
  • a transformFn which is not meant to be called, only set, is a function that the value will go through and be set on a widget property
  • a callable transform method which returns a new instance of Binding with an updated transfromFn

it is possible to chain transforms since they will be composed, I think they are called composite functions in math

this Binding struct is only used in Widget constructors. the above mentioned three properties emitter, prop, transformFn will be "consumed" and be translated into Widget.bind calls which are just again translat…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by arzcbnh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants