convertListen<T extends Object> method
Convert an object that has no listeners to a listener object.
mark
--
Is the unique identifier of the shared data object before the query.
broadcast
--
Listener broadcast form of shared object.
sync
--
Whether the broadcast event should be delayed.
Implementation
void convertListen<T extends Object>({
String? mark,
bool broadcast = false,
bool sync = false,
}) {
final String key = keyGet<T>(mark);
final bool isExist = _recordPool.keys.contains(key);
final StreamController<T> streamController = broadcast ? StreamController<T>.broadcast(sync: sync) : StreamController<T>(sync: sync);
_recordListenPool[key] = streamController;
if (isExist) {
_recordPool.remove(key);
}
}