getContentSensitivity method

Future<ContentSensitivity> getContentSensitivity()

Gets content sensitivity level of the app window (Android View) that contains the app's widget tree.

Implementation

Future<ContentSensitivity> getContentSensitivity() async {
  final int? result = await sensitiveContentChannel.invokeMethod<int>(
    'SensitiveContent.getContentSensitivity',
  );

  final ContentSensitivity contentSensitivity = ContentSensitivity.values[result!];
  if (contentSensitivity == ContentSensitivity._unknown) {
    throw UnsupportedError(
      'Android Flutter View has a content sensitivity mode '
      'that is not recognized by Flutter. If you see this error, it '
      'is possible that the View uses a new mode that Flutter needs to '
      'support; please file an issue.',
    );
  }

  return contentSensitivity;
}