getUserStatus method

  1. @override
Future<AgeSignalResult> getUserStatus()
override

Fetches the user's Play age verification status via the MethodChannel.

Returns an AgeSignalResult containing:

  • userStatus: VERIFIED / UNVERIFIED
  • ageLower and ageUpper bounds (if available)
  • installId: unique identifier of the Play install
  • mostRecentApprovalDate: date of last verification
  • error: any error encountered during the verification process

If an exception occurs while invoking the platform method, it is caught and returned as the error field in the AgeSignalResult.

Implementation

@override
Future<AgeSignalResult> getUserStatus() async {
  try {
    final Map<dynamic, dynamic> res =
        await methodChannel.invokeMethod('getUserStatus');
    return AgeSignalResult.fromMap(Map<String, dynamic>.from(res));
  } catch (e) {
    return AgeSignalResult(error: e.toString());
  }
}