You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, I want child components to accept a parameter from the parent component, and I want certain methods to be called when the child component is created, such as fetching data.
Can i do it just like this?
UI
classTestComponentextendsStatelessWidget {
constTestComponent({super.key, requiredthis.param});
finalString param;
@overrideWidgetbuild(BuildContext context) {
final logic =Get.put(TestLogic(param: param));
final state =Bind.find<TestLogic>().state;
returnContainer();
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In some cases, I want child components to accept a parameter from the parent component, and I want certain methods to be called when the child component is created, such as fetching data.
Can i do it just like this?
UI
Logic
It works fine, but I'm not sure if there are any side effects.
Beta Was this translation helpful? Give feedback.
All reactions