質問編集履歴
5
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -93,24 +93,8 @@
|
|
93
93
|
}
|
94
94
|
return null;
|
95
95
|
}
|
96
|
+
}
|
96
97
|
|
97
|
-
static Future<void> fetchComments() async {
|
98
|
-
try {
|
99
|
-
final QuerySnapshot snapshot = await comments.get();
|
100
|
-
for (var doc in snapshot.docs) {
|
101
|
-
if (kDebugMode) {
|
102
|
-
print(
|
103
|
-
"Successful acquisition of comment information. ${doc.id} ----- NAME: ${(doc.data() as Map<String, dynamic>)['name']}");
|
104
|
-
}
|
105
|
-
}
|
106
|
-
} catch (e, stackTrace) {
|
107
|
-
if (kDebugMode) {
|
108
|
-
print("Failure to obtain comment information. $e");
|
109
|
-
print(stackTrace); // スタックトレースを出力することでエラーの詳細を確認できます
|
110
|
-
}
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
98
|
|
115
99
|
|
116
100
|
|
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -65,14 +65,21 @@
|
|
65
65
|
if (kDebugMode) {
|
66
66
|
print(data);
|
67
67
|
}
|
68
|
+
// Account commentAccount = Account(
|
69
|
+
// id: accountId,
|
70
|
+
// name: data['name'],
|
71
|
+
// imagePath: data['image_path'],
|
72
|
+
// selfIntroduction: data['self_introduction'],
|
73
|
+
// userId: data['user_id'],
|
74
|
+
// );
|
68
|
-
|
75
|
+
Comment commentAccount = Comment(
|
69
76
|
id: accountId,
|
70
|
-
n
|
77
|
+
content: data['content'],
|
78
|
+
commentAccountId: data['comment_account_id'],
|
71
79
|
imagePath: data['image_path'],
|
72
|
-
selfIntroduction: data['self_introduction'],
|
73
|
-
|
80
|
+
commentTime: Timestamp.now(),
|
74
81
|
);
|
75
|
-
map[accountId] = commentAccount;
|
82
|
+
map[accountId] = commentAccount as Account;
|
76
83
|
if (kDebugMode) {
|
77
84
|
print("Completed acquisition of comment user information.");
|
78
85
|
}
|
@@ -106,6 +113,7 @@
|
|
106
113
|
}
|
107
114
|
|
108
115
|
|
116
|
+
|
109
117
|
```
|
110
118
|
|
111
119
|
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,7 +58,13 @@
|
|
58
58
|
try {
|
59
59
|
await Future.forEach(accountIds, (String accountId) async {
|
60
60
|
var doc = await comments.doc(accountId).get();
|
61
|
+
if (kDebugMode) {
|
62
|
+
print(doc);
|
63
|
+
}
|
61
64
|
Map<String, dynamic> data = doc.data() as Map<String, dynamic>;
|
65
|
+
if (kDebugMode) {
|
66
|
+
print(data);
|
67
|
+
}
|
62
68
|
Account commentAccount = Account(
|
63
69
|
id: accountId,
|
64
70
|
name: data['name'],
|
@@ -80,7 +86,25 @@
|
|
80
86
|
}
|
81
87
|
return null;
|
82
88
|
}
|
89
|
+
|
90
|
+
static Future<void> fetchComments() async {
|
91
|
+
try {
|
92
|
+
final QuerySnapshot snapshot = await comments.get();
|
93
|
+
for (var doc in snapshot.docs) {
|
94
|
+
if (kDebugMode) {
|
95
|
+
print(
|
96
|
+
"Successful acquisition of comment information. ${doc.id} ----- NAME: ${(doc.data() as Map<String, dynamic>)['name']}");
|
97
|
+
}
|
98
|
+
}
|
99
|
+
} catch (e, stackTrace) {
|
100
|
+
if (kDebugMode) {
|
101
|
+
print("Failure to obtain comment information. $e");
|
102
|
+
print(stackTrace); // スタックトレースを出力することでエラーの詳細を確認できます
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
83
106
|
}
|
107
|
+
|
84
108
|
|
85
109
|
```
|
86
110
|
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,6 +108,7 @@
|
|
108
108
|
ググってヒットしたページ
|
109
109
|
https://zenn.dev/tsuruo/articles/a3d77c4854e108
|
110
110
|
https://firebase.google.com/docs/firestore/query-data/get-data?hl=ja
|
111
|
+
https://tech.fundasta.co.jp/2022/01/11/y_suzuki/654
|
111
112
|
|
112
113
|
###追記
|
113
114
|
以下のページを見ながら、新たにメソッドを追加
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -109,3 +109,6 @@
|
|
109
109
|
https://zenn.dev/tsuruo/articles/a3d77c4854e108
|
110
110
|
https://firebase.google.com/docs/firestore/query-data/get-data?hl=ja
|
111
111
|
|
112
|
+
###追記
|
113
|
+
以下のページを見ながら、新たにメソッドを追加
|
114
|
+
https://www.udemy.com/course/flutter-firebase-chat/learn/lecture/33208636?start=210#overview
|