on method

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

Apply the callback function to each change of the document.

Implementation

User on(Function(dynamic data, String key) cb) {
  final user = _user.on(allowInterop(
    (dynamic data, key, dynamic msg, dynamic ev) {
      cb(jsToDart(data), key);
    },
  ));
  return User._(user);
}