質問編集履歴
3
メソッド化
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,30 @@
|
|
22
22
|
|
23
23
|
```dart
|
24
24
|
|
25
|
+
|
26
|
+
|
27
|
+
class UserList extends StatelessWidget {
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
@override
|
32
|
+
|
33
|
+
Widget build(BuildContext context) {
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
return Scaffold(
|
38
|
+
|
39
|
+
appBar: AppBar(title: Text('')),
|
40
|
+
|
41
|
+
body: Text(getCurrentUser()),
|
42
|
+
|
43
|
+
);
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
|
25
49
|
String getCurrentUser() {
|
26
50
|
|
27
51
|
FirebaseAuth.instance.currentUser().then((user){
|
@@ -32,4 +56,6 @@
|
|
32
56
|
|
33
57
|
}
|
34
58
|
|
59
|
+
}
|
60
|
+
|
35
61
|
```
|
2
メソッド化
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,14 @@
|
|
22
22
|
|
23
23
|
```dart
|
24
24
|
|
25
|
+
String getCurrentUser() {
|
26
|
+
|
25
|
-
FirebaseAuth.instance.currentUser().then((user){
|
27
|
+
FirebaseAuth.instance.currentUser().then((user){
|
28
|
+
|
29
|
+
return user.uid;
|
30
|
+
|
31
|
+
});
|
32
|
+
|
33
|
+
}
|
26
34
|
|
27
35
|
```
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
簡単なチャットアプリを作るのにFlutterとFirebaseを使っているのですが、
|
5
|
+
簡単なチャットアプリを作るのにFlutterとFirebaseAuthを使っているのですが、
|
6
6
|
|
7
7
|
メソッドの返り値でFirebaseAuthのcurrentUserからuidだけを取り出すのにはどうしたらいいでしょうか。
|
8
8
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
currentUserの戻り値はFuture<FirebaseUser>です。
|
12
12
|
|
13
|
-
dartの文法と非同期クラスの扱いをよく理解していないのですが、thenメソッドの中身を取り出すイメージです。
|
13
|
+
dartの文法と非同期クラスの扱いをよく理解していないのですが、Futureクラスのthenメソッドの中身を取り出すイメージです。
|
14
14
|
|
15
15
|
|
16
16
|
|