'How to make use of the user defined View to pipe data into application with flutter/drift(moor)

I declared some Views following the example in the drift documentation besides database table definitions and managed to go through the generation process. After then I was quite confused as to the usage of the abstract View classes, which I could neither instantiate to make query nor incorporate it into query definitions(get or watch).

abstract class TestingRemoteSignalView extends View {
  TestingRemoteSignal get testingRemoteSignal;
  Bay get bay;
  RemoteSignal get remoteSignal;
  Expression<String> get description => bay.name + remoteSignal.signalName;

  @override
  Query as() {
    return select([
      testingRemoteSignal.id,
      bay.name,
      description,
      testingRemoteSignal.passed,
      testingRemoteSignal.skipped,
      testingRemoteSignal.touched,
      testingRemoteSignal.memo,
    ]).from(testingRemoteSignal).join([
      innerJoin(bay, testingRemoteSignal.bay.equalsExp(bay.id)),
      innerJoin(
          remoteSignal, testingRemoteSignal.signal.equalsExp(remoteSignal.id))
    ]);
  }
}

What is the use of these View classes and how to make queries out of them? Maybe something like:

final query = select(TestingRemoteSignalView)..where((t) => t.passed.isEquals(true));
query.watch();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source