onUpdate method

void onUpdate(
  1. BuildContext context,
  2. T viewModel
)

Override this method to react to widget updates.

Called whenever the widget configuration changes. Use this to pass updated props to the ViewModel. The ViewModel should contain the logic to determine if any action is needed.

Example:

class UserProfile extends ViewWidget<UserProfileViewModel> {
  final String userId;

  @override
  void onUpdate(BuildContext context, UserProfileViewModel vm) {
    vm.setUserId(userId); // ViewModel decides if reload is needed
  }
...
}

Implementation

void onUpdate(BuildContext context, T viewModel) {}