signInWithGameService method

  1. @override
Future<bool> signInWithGameService()
override

Signs the user in with the platform's native game service.

Returns a Future that resolves with true if the sign-in is successful, or false otherwise.

Logs any platform exceptions that occur during the sign-in process.

Implementation

@override
Future<bool> signInWithGameService() async {
  final bool? success;
  try {
    // Invoke the native method for signing in with the game service.
    success =
        await methodChannel.invokeMethod<bool>('signInWithGameService') ??
            false;
  } on PlatformException catch (e) {
    // Log the error if the platform throws an exception.
    _log.severe('Failed to sign in with Game Service: ${e.message}');
    return false;
  }
  _log.fine('Game Service sign in successful');
  return success;
}