File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
- // This code is just example code to show how mimic app work
2
- // This code is not working and just for educational purpose
3
-
4
1
import 'dart:async' ;
2
+ import 'dart:io' ;
5
3
import 'dart:math' ;
6
4
import 'package:http/http.dart' as http;
7
5
import 'dart:convert' ;
@@ -59,6 +57,10 @@ class PlatformActivitySimulator {
59
57
);
60
58
61
59
return response.statusCode == 200 ;
60
+ } on SocketException catch (e) {
61
+ print ('SocketException: $e ' );
62
+ if (attempt == 2 ) rethrow ;
63
+ await Future .delayed (Duration (seconds: pow (2 , attempt).toInt ()));
62
64
} catch (e) {
63
65
if (attempt == 2 ) rethrow ;
64
66
await Future .delayed (Duration (seconds: pow (2 , attempt).toInt ()));
@@ -108,4 +110,4 @@ void main() {
108
110
Future .delayed (const Duration (minutes: 1 ), () {
109
111
simulator.stop ();
110
112
});
111
- }
113
+ }
You can’t perform that action at this time.
0 commit comments