onInterestChanges method

  1. @override
Future<void> onInterestChanges(
  1. OnInterestsChange callback
)
override

Registers a listener which calls back the OnInterestsChange function on interests modifications within this device. This is not implemented on web.

Example Usage

function someAsyncFunction() async {
  await PusherBeams.instance.onInterestChanges((interests) => {
    print('Interests: $interests') // This prints Interests: ['banana', 'apple', ...]
  });
}

Throws an Exception in case of failure.

Implementation

@override
Future<void> onInterestChanges(OnInterestsChange callback) async {
  final callbackId = _uuid.v4();

  if (!kIsWeb) {
    _callbacks[callbackId] = callback;
  }

  await _pusherBeamsApi.onInterestChanges(kIsWeb ? callback : callbackId);
}