0

我有一个带有对象框数据库的分层颤振应用程序。每当发生任何数据库更改时,数据库都能够使用流发出数据。我的班级结构如下图所示。


class UserRepo {
  
  void createSubscription() {
    // method to get stream from database
    //Stream stream = _database.getUser();
  }  
}


class RepoHandler {
  
  // select repo
  // get data from repo
  
}


class BusinessLogic {
  
  // get user
  // do something

  // get another data
  // combine another class to get modified user

}


class UIController {
  
  // get modified user from business logic
  // has stream 
  
}


class UI {
  
  // get user from UI controller
  // consumes UI controller stream and uses stream builder
  
}

在业务逻辑上,将不同的模型组合起来创建视图模型,这些视图模型被馈送到控制器并最终馈送到 UI。

早些时候,我们从数据库中获取简单的飞镖模型。现在要求更改为实时获取更改。我不确定如何在 repo 类中使用流将数据一直带到UIController类中。飞镖模型在每一层都发生变化。有人可以在这里指导我吗?谢谢。

4

0 回答 0