小编Nam*_*yfe的帖子

Flutter 将多个 FireStore 流与 Rxdart 结合

我想我需要在某个地方将它合并在一起,但我不知道如何以及在哪里。我想在 StreamBuilder 中使用?我把你带到这里等着你的帮助..

getCombinedMatches(uid) {
    return Firestore.instance
        .collection('matches')
        .where('match', arrayContains: uid)
        .snapshots()
        .map((convert) {
      return convert.documents.map((f) {
        Observable<Matches> match = f.reference
            .snapshots()
            .map<Matches>((document) => Matches.fromMap(document.data));
        Observable<User> user = Firestore.instance
            .collection("users")
            .document(uid)
            .snapshots()
            .map<User>((document) => User.fromMap(document.data));

        Observable<Message> message = Firestore.instance
            .collection('matches')
            .document(f.documentID)
            .collection("chat")
            .orderBy('dater', descending: true)
            .limit(1)
            .snapshots()
            .expand((snapShot) => snapShot.documents)
            .map<Message>((document) => Message.fromMap(document.data));

        return Observable.combineLatest3(match, user, message,
            (matches, user, message) => CombinedStream(matches, user, message));
      });
    });
  }
Run Code Online (Sandbox Code Playgroud)

stream observable dart flutter rxdart

5
推荐指数
1
解决办法
714
查看次数

模板语句中的 Angular 异步参数

我目前很难弄清楚如何在进行事件绑定时在模板语句中使用异步参数。

我尝试过以下片段:

<div (click)="goToProfile((user|async)?.id)"></div>
Run Code Online (Sandbox Code Playgroud)

它失败了

ng:解析器错误:@2:19 中 [goToProfile((user|async)?.id)] 中第 20 列的操作表达式中不能有管道 ng:找不到管道 ''

event-binding angular

2
推荐指数
1
解决办法
2584
查看次数

标签 统计

angular ×1

dart ×1

event-binding ×1

flutter ×1

observable ×1

rxdart ×1

stream ×1