setTest method

Future<bool> setTest(
  1. bool value
)

Sets the test flag for the current subscription.

This marks the subscription as a test subscription, making it available for segment filtering on the "test" parameter in the SuperFCM dashboard.

Parameters:

  • value: Boolean indicating whether this subscription is a test subscription

Example:

// Mark this device as a test device
await SuperFCM.instance.setTest(true);

Implementation

Future<bool> setTest(bool value) async {
  return _queueOrExecute("setTest", () async {
    logger.i('Setting test subscription status to: $value');
    if (subscription?.test == value) {
      logger.v('Test subscription status already set to $value');
      return true;
    }
    final response = await _patch(
        'subscriptions/${subscription?.id}',
        {
          'test': value,
        },
        _config!.cacheOnOffline);

    return _handleResponse(
      response,
      'set test subscription status',
      onSuccess: (response) {
        subscription = subscription!.copyWith(test: value);
        _storeSubscription();
      },
    );
  });
}