We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b06e86d commit d52f66fCopy full SHA for d52f66f
1 file changed
lib/receieve.dart
@@ -25,13 +25,11 @@ class ReceiveFile {
25
return WillPopScope(
26
// 戻る無効化
27
onWillPop: () => Future.value(false),
28
- child: AlertDialog(
29
- title: const Text("接続しています..."),
30
- actions: <Widget>[
31
- TextButton(
32
- onPressed: () => connectionTask.cancel(),
33
- child: const Text("キャンセル")),
34
- ],
+ child: const AlertDialog(
+ title: Text(
+ "接続しています...",
+ textAlign: TextAlign.center,
+ ),
35
),
36
);
37
});
@@ -41,8 +39,8 @@ class ReceiveFile {
41
39
42
40
// 最初の接続を開始
43
try {
44
- connectionTask = await Socket.startConnect(ip, 4782);
45
- socket = await connectionTask.socket;
+ socket =
+ await Socket.connect(ip, 4782, timeout: const Duration(seconds: 10));
46
socket.add(utf8.encode("first"));
47
} on SocketException catch (e) {
48
Wakelock.disable();
0 commit comments