checkAndRun method
Check if application can run and perform initialization
Parameters:
- config: Combined configuration object
Returns:
- true: Application can start
- false: Another instance is already running
Implementation
@override
Future<bool> checkAndRun({required FlutterAloneConfig config}) async {
try {
// Convert config to map
final map = config.toMap();
// Remove null values
map.removeWhere((key, value) => value == null);
final result = await _channel.invokeMethod<bool>(
'checkAndRun',
map,
);
return result ?? false;
} on PlatformException catch (e) {
throw AloneException(
code: e.code,
message: e.message ?? 'Error checking application instance',
details: e.details,
);
}
}