Peter Mandeljc
02/07/2023, 10:23 AMFlow<Boolean>
with "is". E.g. val isVisible: Flow<Boolean>
?Sam
02/07/2023, 10:34 AMis
prefix for those, though I can’t find a mention in the official style guide…ephemient
02/07/2023, 10:50 AMephemient
02/07/2023, 10:51 AMvar foo: Any
behaves like
public Object getFoo();
public void setFoo(Object);
in Javaephemient
02/07/2023, 10:52 AMpublic boolean isFoo();
to be a getter for the foo
property, only if the type is boolean
.ephemient
02/07/2023, 10:52 AMFlow<Boolean>
, so I would not name it isVisible
Oliver.O
02/07/2023, 10:55 AMJavier
02/07/2023, 10:56 AMisBoolean()
over isBoolean
are contracts, when contracts are supported on getters and not only functions, probably all will be moved to getters instead of normal functionsephemient
02/07/2023, 10:57 AMephemient
02/07/2023, 10:57 AMephemient
02/07/2023, 10:58 AMJavier
02/07/2023, 10:58 AMFlow
box disappears, they use isVisible
tooJavier
02/07/2023, 10:59 AMisVisibleStream
over isVisible
, I would stick without Stream
IMOephemient
02/07/2023, 11:00 AMvisibilities.collect { isVisible -> }
reads better to me than
isVisible.collect { ??? -> }
Javier
02/07/2023, 11:00 AM@JvmName
can help there?Javier
02/07/2023, 11:02 AMvisibilities
looks weird for me, it is the state of an element, so it can look like there are visibilities for multiple components on the first sightOliver.O
02/07/2023, 11:02 AMSam
02/07/2023, 11:04 AMisVisibleStream
. The type already conveys that.Javier
02/07/2023, 11:05 AMFlow<List<Boolean>>
Javier
02/07/2023, 11:05 AMvisibilities
for meSam
02/07/2023, 11:15 AMisVisible
be more palatable for a StateFlow
than a plain old Flow
?Oliver.O
02/07/2023, 11:17 AMMutableState
, I'd name it isVisible
. With flows, the plural makes sense to me, because it becomes a series of changes, and that's a different beast than a single value, even if it were a changing single value.ephemient
02/07/2023, 11:23 AMStateFlow<Boolean>
results in isVisible.value
which I don't like, but it's less bad than the Flow<Boolean>
scenario IMOJavier
02/07/2023, 11:23 AMMutableState
and Flow
, or whatever Flow
like box as it is a series of elements. Indeed with Molecule you get with Flow
the same you have with MutableState
ephemient
02/07/2023, 11:24 AMMutableStateFlow
is a Flow
of course, so in the cases where you're using it as a flow (and performing mapping operations on it or collecting it) then I would apply the Flow
rules to itephemient
02/07/2023, 11:25 AMvalue
once is… eh, not that badJavier
02/07/2023, 11:25 AMvisibilities.collect(MyComponent::show)
vs
isVisible.collect(MyComponent::show)
Oliver.O
02/07/2023, 11:26 AMThere is no difference betweenThen how would you iterate over a series of values with plainandMutableState
,Flow
MutableState
?ephemient
02/07/2023, 11:26 AMephemient
02/07/2023, 11:27 AMJavier
02/07/2023, 11:27 AMMutableState
which they do a trick as with Compose you "remove" the box, so it is a series of values but you write it like if it was only oneJavier
02/07/2023, 11:27 AMval isVisible = visibilities.collectAsState()
ephemient
02/07/2023, 11:27 AMJavier
02/07/2023, 11:28 AMephemient
02/07/2023, 11:28 AMephemient
02/07/2023, 11:28 AMJavier
02/07/2023, 11:29 AMval state = store.state.collectAsState()
Oliver.O
02/07/2023, 11:29 AMMutableState
. I'd name the base value and its mutable variant the same, so not Hungarian.Javier
02/07/2023, 11:29 AMstore.states.collectAsState()
exists, I haven't used it too muchJavier
02/07/2023, 11:31 AM_states
? or _state
?
_states.value = ...
vs
_state.value = ...
Javier
02/07/2023, 11:32 AMstates
or state
so the consumer and the producer will use the same onePeter Mandeljc
02/07/2023, 11:41 AMFlowState
and not FlowStates
?ephemient
02/07/2023, 11:42 AMval names: List<Name>
ephemient
02/07/2023, 11:43 AMPeter Mandeljc
02/07/2023, 11:53 AMephemient
02/07/2023, 11:55 AMlouiscad
02/11/2023, 6:43 PMisVisibleFlow
or isVisible
if it doesn't create name clashes and it doesn't end up being more confusing.