watch method
Executes an SQL Query that return a single value params - an optional list of parameters to pass to the query fromMap - a function that convert the result map to the returned object singleResult - return an object instead of a list of objects
Implementation
Stream watch(String sql,
{List<Object?> params = const [],
FromMap? fromMap,
bool singleResult = false,
required List<String> tables,
String? dbName}) {
final StreamController sc = StreamController();
// Initial values
final StreamInfo streamInfo = StreamInfo(
controller: sc,
sql: sql,
tables: tables,
params: params,
fromMap: fromMap,
dbName: dbName ?? defaultDBName,
singleResult: singleResult);
streams.add(streamInfo);
_updateStream(streamInfo);
// Remove from list of streams
sc.done.then((value) => streams.remove(streamInfo));
return sc.stream;
}