on method

Gun on(
  1. dynamic cb(
    1. dynamic data,
    2. String key
    )
)

Apply the callback function to each change of the document.

Implementation

Gun on(Function(dynamic data, String key) cb) {
  final gun = _gun.on(allowInterop(
    (dynamic data, key, dynamic msg, dynamic ev) {
      cb(jsToDart(data), key);
    },
  ));
  return Gun._(gun);
}