Vinay Gaba
06/22/2023, 4:21 PMPablichjenkov
06/22/2023, 5:33 PMLandry Norris
06/22/2023, 5:39 PMmohamed rejeb
06/22/2023, 6:05 PM@State
@Binding
@Published
, in compose we just have a state and we need to remember it if we are inside a Composable, it's more flexible and straight forward.Vinay Gaba
06/22/2023, 6:06 PMVinay Gaba
06/22/2023, 6:08 PMstate
syntax as well which internally just did remember
and mutableStateOf
. Before the 1.0 release, that was removed from the API to ensure that developers weren't skipping out learning about remember
and mutableStateOf
which were important concepts to grasp themselves.Landry Norris
06/22/2023, 6:10 PMclass ConditionalComponent extends StatelessWidget {
final bool condition;
ConditionalComponent({required this.condition});
@override
Widget build(BuildContext context) {
if(condition) {
return Text("Condition is true");
} else {
return Text("Condition is false");
}
}
// Usage
ConditionalComponent(condition: true)
Landry Norris
06/22/2023, 6:11 PMVinay Gaba
06/22/2023, 6:13 PMmohamed rejeb
06/22/2023, 6:13 PMStatefullWidget
and a remember
mutableStateOf
for Compose. But for StatelessWidget
could just be compared with a Composable containing some params without mutable states.Zach Klippenstein (he/him) [MOD]
06/22/2023, 6:19 PMPablichjenkov
06/22/2023, 6:31 PMcurioustechizen
06/23/2023, 3:35 AM