You can't assign _handleStateChange
to onStateChange
, their types are different, how about just call _handleStateChange
like this
_listener = AppLifecycleListener(
onStateChange: (state) {
_handleStateChange(context);
},
);