optOut method

Future<void> optOut()

Opt-out from Batch SDK. A opt-out request will also be sent to Batch servers if possible. The SDK will save the opt-out and stop running even if the network request fails.

Some modules might behave unexpectedly when the SDK is opted out from.

Opting out will:

  • Prevent the SDK from being started until you call optIn()
  • Disable any network capability from the SDK
  • Disable all In-App campaigns
  • Make the Inbox module return an error immediatly
  • Make any call to BatchUserDataEditor.save() do nothing
  • Make any "track" methods from BatchUser ineffective

Even if you opt-in afterwards, data generated (such as user data or tracked events) while opted out WILL be lost.

If you also want to delete user data, please see Batch.optOutAndWipeData().

To implement a consent request where Batch should not be enabled until the user explicitly opts-in, please see our documentation for opting out of Batch by default, rather than using this method.

Implementation

Future<void> optOut() async {
  await _channel.invokeMethod('optOut');
}