@@ -5,132 +5,132 @@ import 'package:dart_native/dart_native.dart';
5
5
import 'package:flutter/services.dart' ;
6
6
7
7
testAndroid (RuntimeStub stub) {
8
- // int ms = currentTimeMillis();
9
- // double resultDouble = stub.getDouble(10.0);
10
- // int use = currentTimeMillis() - ms;
11
- // print('getDouble result:$resultDouble , cost:$use');
12
- //
13
- // ms = currentTimeMillis();
14
- // String resultChar = stub.getChar('a');
15
- // use = currentTimeMillis() - ms;
16
- // print('getChar result:$resultChar , cost:$use');
17
- //
18
- // ms = currentTimeMillis();
19
- // int resultInt = stub.getInt(10);
20
- // use = currentTimeMillis() - ms;
21
- // print('getInt result:$resultInt , cost:$use');
22
- //
23
- // ms = currentTimeMillis();
24
- // bool resultBool = stub.getBool(true);
25
- // use = currentTimeMillis() - ms;
26
- // print('getBool result:$resultBool');
27
- //
28
- // ms = currentTimeMillis();
29
- // double resultFloat = stub.getFloat(10.5);
30
- // use = currentTimeMillis() - ms;
31
- // print('getFloat result:$resultFloat , cost:$use');
32
- //
33
- // ms = currentTimeMillis();
34
- // int resultByte = stub.getByte(1);
35
- // use = currentTimeMillis() - ms;
36
- // print('getByte result:$resultByte , cost:$use');
37
- //
38
- // ms = currentTimeMillis();
39
- // int resultShort = stub.getShort(1);
40
- // use = currentTimeMillis() - ms;
41
- // print('getShort result:$resultShort , cost:$use');
42
- //
43
- // ms = currentTimeMillis();
44
- // int resultLong = stub.getLong(100);
45
- // use = currentTimeMillis() - ms;
46
- // print('getLong result:$resultLong , cost:$use');
47
- //
48
- // ms = currentTimeMillis();
49
- // String resultString = stub.getString("test is success?");
50
- // use = currentTimeMillis() - ms;
51
- // print('getString result:$resultString');
52
- //
53
- // // int time = DateTime.now().millisecondsSinceEpoch;
54
- // // for (var i = 0; i < 10000; i++) {
55
- // // stub.getString("This is a long string: sdlfdksjflksndhiofuu2893873(*(%¥#@)*&……¥撒肥料开发时傅雷家书那份会计师东方丽景三等奖");
56
- // // }
57
- // // print("DartNative int Cost: ${DateTime.now().millisecondsSinceEpoch - time}");
58
- // //
59
- //
60
- // ms = currentTimeMillis();
61
- // int resultAdd = stub.add(10, 20);
62
- // use = currentTimeMillis() - ms;
63
- // print('add result:$resultAdd, cost:$use');
64
- //
65
- // ms = currentTimeMillis();
66
- // stub.log("testlog", "log test");
67
- // use = currentTimeMillis() - ms;
68
- // print('testlog, cost:$use');
69
- //
70
- // bool resultCall =
71
- // stub.complexCall("test", 10, 'a', 10.0, 12.0, 1, 2, 10000, false);
72
- // print('call result:$resultCall');
73
- //
74
- // Entity entity = stub.createEntity();
75
- // print('entity get time : ${entity.getCurrentTime()}');
76
- // print('stub get time : ${stub.getTime(entity)}');
77
- //
78
- // print('new entity get time : ${stub.getTime(new Entity())}');
8
+ int ms = currentTimeMillis ();
9
+ double resultDouble = stub.getDouble (10.0 );
10
+ int use = currentTimeMillis () - ms;
11
+ print ('getDouble result:$resultDouble , cost:$use ' );
79
12
80
- stub.setDelegateListener (DelegateStub ());
13
+ ms = currentTimeMillis ();
14
+ String resultChar = stub.getChar ('a' );
15
+ use = currentTimeMillis () - ms;
16
+ print ('getChar result:$resultChar , cost:$use ' );
81
17
82
- // print("integer ${stub.getInteger()}");
83
- //
84
- // List list = stub.getList([1, 2, 3, 4]);
85
- // for (int item in list) {
86
- // print("item $item");
87
- // }
88
- //
89
- // list = stub.getByteList([byte(1), byte(2), byte(3), byte(4)]);
90
- // for (int item in list) {
91
- // print("item $item");
92
- // }
93
- //
94
- // list = stub.getFloatList([float(1.0), float(2.0), float(3.0), float(4.0)]);
95
- // for (double item in list) {
96
- // print("item $item");
97
- // }
98
- //
99
- // list = stub.getCycleList([
100
- // [1, 2, 3],
101
- // [4, 5, 6],
102
- // [7, 8, 9]
103
- // ]);
104
- // for (List items in list) {
105
- // for (int item in items) {
106
- // print("item $item");
107
- // }
108
- // }
109
- //
110
- // List byteArray = stub.getByteArray([byte(1), byte(2), byte(3)]);
111
- // for (int byte in byteArray) {
112
- // print("item $byte");
113
- // }
114
- //
115
- // Set intSet = stub.getIntSet(Set.from([1, 2, 3]));
116
- // for (int setInt in intSet) {
117
- // print("intSet $setInt");
118
- // }
119
- //
120
- // Set fSet = stub.getFloatSet(Set.from([float(1.0), float(2.0), float(4.0)]));
121
- // for (double setF in fSet) {
122
- // print("fSet $setF");
18
+ ms = currentTimeMillis ();
19
+ int resultInt = stub.getInt (10 );
20
+ use = currentTimeMillis () - ms;
21
+ print ('getInt result:$resultInt , cost:$use ' );
22
+
23
+ ms = currentTimeMillis ();
24
+ bool resultBool = stub.getBool (true );
25
+ use = currentTimeMillis () - ms;
26
+ print ('getBool result:$resultBool ' );
27
+
28
+ ms = currentTimeMillis ();
29
+ double resultFloat = stub.getFloat (10.5 );
30
+ use = currentTimeMillis () - ms;
31
+ print ('getFloat result:$resultFloat , cost:$use ' );
32
+
33
+ ms = currentTimeMillis ();
34
+ int resultByte = stub.getByte (1 );
35
+ use = currentTimeMillis () - ms;
36
+ print ('getByte result:$resultByte , cost:$use ' );
37
+
38
+ ms = currentTimeMillis ();
39
+ int resultShort = stub.getShort (1 );
40
+ use = currentTimeMillis () - ms;
41
+ print ('getShort result:$resultShort , cost:$use ' );
42
+
43
+ ms = currentTimeMillis ();
44
+ int resultLong = stub.getLong (100 );
45
+ use = currentTimeMillis () - ms;
46
+ print ('getLong result:$resultLong , cost:$use ' );
47
+
48
+ ms = currentTimeMillis ();
49
+ String resultString = stub.getString ("test is success?" );
50
+ use = currentTimeMillis () - ms;
51
+ print ('getString result:$resultString ' );
52
+
53
+ // int time = DateTime.now().millisecondsSinceEpoch;
54
+ // for (var i = 0; i < 10000; i++) {
55
+ // stub.getString("This is a long string: sdlfdksjflksndhiofuu2893873(*(%¥#@)*&……¥撒肥料开发时傅雷家书那份会计师东方丽景三等奖");
123
56
// }
57
+ // print("DartNative int Cost: ${DateTime.now().millisecondsSinceEpoch - time}");
124
58
//
125
- // Map map = stub.getMap({"1": 10, "2": 20, "3": 30});
126
- // map.forEach((key, value) {
127
- // print("map from native $key : $value");
128
- // });
129
- //
130
- // List strList = stub.getStringList(["test啊 emoji🤣", "emoji🤣"]);
131
- // for (var item in strList) {
132
- // print("item $item");
133
- // }
59
+
60
+ ms = currentTimeMillis ();
61
+ int resultAdd = stub.add (10 , 20 );
62
+ use = currentTimeMillis () - ms;
63
+ print ('add result:$resultAdd , cost:$use ' );
64
+
65
+ ms = currentTimeMillis ();
66
+ stub.log ("testlog" , "log test" );
67
+ use = currentTimeMillis () - ms;
68
+ print ('testlog, cost:$use ' );
69
+
70
+ bool resultCall =
71
+ stub.complexCall ("test" , 10 , 'a' , 10.0 , 12.0 , 1 , 2 , 10000 , false );
72
+ print ('call result:$resultCall ' );
73
+
74
+ Entity entity = stub.createEntity ();
75
+ print ('entity get time : ${entity .getCurrentTime ()}' );
76
+ print ('stub get time : ${stub .getTime (entity )}' );
77
+
78
+ print ('new entity get time : ${stub .getTime (new Entity ())}' );
79
+
80
+ stub.setDelegateListener (DelegateStub ());
81
+
82
+ print ("integer ${stub .getInteger ()}" );
83
+
84
+ List list = stub.getList ([1 , 2 , 3 , 4 ]);
85
+ for (int item in list) {
86
+ print ("item $item " );
87
+ }
88
+
89
+ list = stub.getByteList ([byte (1 ), byte (2 ), byte (3 ), byte (4 )]);
90
+ for (int item in list) {
91
+ print ("item $item " );
92
+ }
93
+
94
+ list = stub.getFloatList ([float (1.0 ), float (2.0 ), float (3.0 ), float (4.0 )]);
95
+ for (double item in list) {
96
+ print ("item $item " );
97
+ }
98
+
99
+ list = stub.getCycleList ([
100
+ [1 , 2 , 3 ],
101
+ [4 , 5 , 6 ],
102
+ [7 , 8 , 9 ]
103
+ ]);
104
+ for (List items in list) {
105
+ for (int item in items) {
106
+ print ("item $item " );
107
+ }
108
+ }
109
+
110
+ List byteArray = stub.getByteArray ([byte (1 ), byte (2 ), byte (3 )]);
111
+ for (int byte in byteArray) {
112
+ print ("item $byte " );
113
+ }
114
+
115
+ Set intSet = stub.getIntSet (Set .from ([1 , 2 , 3 ]));
116
+ for (int setInt in intSet) {
117
+ print ("intSet $setInt " );
118
+ }
119
+
120
+ Set fSet = stub.getFloatSet (Set .from ([float (1.0 ), float (2.0 ), float (4.0 )]));
121
+ for (double setF in fSet) {
122
+ print ("fSet $setF " );
123
+ }
124
+
125
+ Map map = stub.getMap ({"1" : 10 , "2" : 20 , "3" : 30 });
126
+ map.forEach ((key, value) {
127
+ print ("map from native $key : $value " );
128
+ });
129
+ //
130
+ List strList = stub.getStringList (["test啊 emoji🤣" , "emoji🤣" ]);
131
+ for (var item in strList) {
132
+ print ("item $item " );
133
+ }
134
134
}
135
135
136
136
int currentTimeMillis () {
0 commit comments