setNotificationUri method

Future<void> setNotificationUri(
  1. String uri
)

https://developer.android.com/reference/kotlin/android/database/Cursor#setnotificationuri

A list of URIs to watch the content changes.

Typically it should match with the URI of some resource of your content provider, that matches this Cursor's content.

This is needed so the receiver of the cursor could observe changes, and re-request the data, if they want.

Speaking in detail, this is needed so that ContentObservers, registered with NativeCursor.registerContentObserver, would receive updates from AndroidContentResolver.notifyChange, which AndroidContentProvider implementation might call when some of its content changes.

If you provide an invalid notification URI, the system will throw a security exception

java.lang.SecurityException: Failed to find provider null for user 0; expected to find a valid ContentProvider for this authority

Implementation

Future<void> setNotificationUri(String uri) {
  assert(!_closed);
  return _methodChannel.invokeMethod<bool>('setNotificationUri', {
    'uri': uri,
  });
}