isSupported method

Future<bool> isSupported()

Returns whether or not setting content sensitivity levels is supported by the device.

This method must be called before attempting to call getContentSensitivity or setContentSensitivity.

This feature is only supported on Android 35+ currently. Its return value will not change and thus, is safe to cache.

Implementation

Future<bool> isSupported() async {
  if (defaultTargetPlatform != TargetPlatform.android) {
    return false;
  }
  return (await sensitiveContentChannel.invokeMethod<bool>('SensitiveContent.isSupported'))!;
}