didChangeAppLifecycleState method

  1. @mustCallSuper
  2. @override
void didChangeAppLifecycleState(
  1. AppLifecycleState state
)
override

Called when the app lifecycle state changes.

This method should be overridden to handle app lifecycle state changes. The state parameter indicates the new app lifecycle state.

Implementation

@mustCallSuper
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  switch (state) {
    case AppLifecycleState.resumed:
      onResumed();
      break;
    case AppLifecycleState.inactive:
      onInactive();
      break;
    case AppLifecycleState.paused:
      onPaused();
      break;
    case AppLifecycleState.detached:
      onDetached();
      break;
    case AppLifecycleState.hidden:
      onHidden();
      break;
  }
}