initPlatformState method
Future<void>
initPlatformState(
)
Implementation
Future<void> initPlatformState() async {
setState(() {
ApplicationState.initializing;
});
_log.info('Initializing platform state');
NotificationsListener.initialize(callbackHandle: _callback);
// this can fix restart<debug> can't handle error
IsolateNameServer.removePortNameMapping("_listener_");
IsolateNameServer.registerPortWithName(port.sendPort, "_listener_");
port.listen((message) => handleNotification(message));
var isRunning = (await NotificationsListener.isRunning) ?? false;
_log.info('Service is already running: $isRunning');
setState(() {
ApplicationState.ready;
});
}