SqlSelectBloc constructor

SqlSelectBloc({
  1. required SqlDb database,
  2. required String table,
  3. int? offset,
  4. int? limit,
  5. String? where,
  6. String columns = "*",
  7. String? joinTable,
  8. String? joinOn,
  9. String? orderBy,
  10. bool reactive = false,
  11. bool verbose = false,
})

Create a select bloc with the specified options. The select bloc will fire a query on creation

Implementation

SqlSelectBloc(
    {required this.database,
    required this.table,
    this.offset,
    this.limit,
    this.where,
    this.columns = "*",
    this.joinTable,
    this.joinOn,
    this.orderBy,
    this.reactive = false,
    this.verbose = false})
    : assert(database != null),
      assert(database.isReady) {
  _getItems();
  if (reactive) {
    _changefeed = database.changefeed.listen((change) {
      if (table != null && change.table == table) {
        _getItems();
      }
      if (verbose) {
        print("CHANGE IN THE DATABASE: $change");
      }
    });
  }
}