filterTablesTransformer static method

Filter an update stream by specific tables.

Implementation

static StreamTransformer<UpdateNotification, UpdateNotification>
    filterTablesTransformer(Iterable<String> tables) {
  Set<String> normalized = {for (var table in tables) table.toLowerCase()};
  return StreamTransformer<UpdateNotification,
      UpdateNotification>.fromHandlers(handleData: (data, sink) {
    if (data.containsAny(normalized)) {
      sink.add(data);
    }
  });
}