setOptOut method

Future<void> setOptOut(
  1. bool optOut
)

Enables tracking opt out.

If the user wants to opt out of all tracking, use this method to enable opt out for them. Once opt out is enabled, no events will be saved locally or sent to the server.

Calling this method again with enabled set to false will turn tracking back on for the user.

Implementation

Future<void> setOptOut(bool optOut) async {
  Map<String, dynamic> properties = _baseProperties();
  properties['optOut'] = optOut;

  return await _channel.invokeMethod('setOptOut', jsonEncode(properties));
}