dimsuz
05/19/2022, 12:53 PMFilip Wiesner
05/19/2022, 1:00 PMWhy would you want Modifier being passed as a first argument to a Composable? 🤔 I personally pass it always as a last parameter because some modifier chains are long and I want to see the "more important" model parameters first. Nothing against your conventions but I would be interested in the reasoning.andModifierArgumentPosition
ensure thatModifierParameterPosition
is declared and passed as a first parameter/argumentmodifier
dimsuz
05/19/2022, 1:04 PMFilip Wiesner
05/19/2022, 1:09 PMReusedModifierInstance
is nice.dimsuz
05/19/2022, 1:12 PMReusedModifierInstance
is indeed the most useful one of those. Others are more or less minor, but occasionally helpful.Adam Powell
05/19/2022, 1:20 PMmodifier =
in the parameter list, it can always be specified positionally if the only other parameters you're using are requireddimsuz
05/19/2022, 1:22 PMmodifier
is mentioned, it won't be enforced at all. This is just to stay consistent when it's used.Filip Wiesner
05/19/2022, 1:22 PMAdam Powell
05/19/2022, 1:24 PMdimsuz
05/19/2022, 1:28 PMFilip Wiesner
05/19/2022, 1:33 PMste
05/19/2022, 1:58 PMmodifier
as the first optional parameter (this can be arguable btw) when it comes to signature, but I always pass it as last (but before any @Composable
param) when it comes to function invocation - I completely agree with Filip.dimsuz
05/19/2022, 2:22 PMModifierArgumentPosition
then and leave only the one which enforces the parameter: ModifierParameterPosition
. It's also arguably subjective, but can be enabled/disabled depending on codebase conventions.ModifierParameterPosition
to check that modifier
is the first optional parameter, rather than always-first as it is now.Adam Powell
05/19/2022, 2:41 PMText(text = "hello")
as opposed to Text("hello")
is sillyhfhbd
05/23/2022, 9:14 AMvar showButton = remember { mutableStateOf(false) }.value
. Although .value
is nice for val
, because it supports data flow analysis (eg smart casts), with var
the state won't update 🤦♂️
Adding this rule would be nice too 😄dimsuz
05/23/2022, 11:24 AMvar showButton by remember { ... }
(note the by
)hfhbd
05/23/2022, 11:28 AMby
, beside val (showButton, setValue) =
. In my codebase, I found it only once, but it easy to make the same mistake again, I think.