Skip to content

Commit 43c3b44

Browse files
committed
Merge tag '0.3.20' into develop
0.3.20
2 parents 9c5c547 + 57b88f2 commit 43c3b44

File tree

5 files changed

+44
-17
lines changed

5 files changed

+44
-17
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ This is the blue part(DartNative Bridge) in the picture below:
2727

2828
## 🔮 Getting Started
2929

30+
##### iOS:
31+
3032
Dart code:
3133

3234
```dart
@@ -57,6 +59,40 @@ typedef int(^BarBlock)(NSObject *a);
5759
@end
5860
```
5961
62+
More ios example see: [ios_unit_test.dart](/dart_native/example/lib/ios/unit_test.dart)
63+
64+
##### Android:
65+
66+
Dart code:
67+
```dart
68+
// new Java object.
69+
RuntimeStub stub = RuntimeStub();
70+
71+
// get java list.
72+
List list = stub.getList([1, 2, 3, 4]);
73+
74+
// support interface.
75+
stub.setDelegateListener(DelegateStub());
76+
77+
```
78+
Java code:
79+
80+
```java
81+
public class RuntimeStub {
82+
83+
public List<Integer> getList(List<Integer> list) {
84+
List<Integer> returnList = new ArrayList<>();
85+
returnList.add(1);
86+
returnList.add(2);
87+
return returnList;
88+
}
89+
90+
public void setDelegateListener(SampleDelegate delegate) {
91+
delegate.callbackInt(1);
92+
}
93+
}
94+
```
95+
More android example see: [android_unit_test.dart](/dart_native/example/lib/android/unit_test.dart)
6096
## 📚 Document
6197

6298
### Readme

dart_native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.20
2+
3+
* [Feature] Support 64 bit on Android.
4+
15
## 0.3.19
26

37
* [Fix] Some crash on Android.

dart_native/example/lib/android/unit_test.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import 'package:dart_native_example/android/delegate_stub.dart';
21
import 'package:dart_native_example/android/runtimestub.dart';
32
import 'package:dart_native_example/android/entity.dart';
43
import 'package:dart_native/dart_native.dart';
5-
import 'package:flutter/services.dart';
64

75
testAndroid(RuntimeStub stub) {
86
int ms = currentTimeMillis();
@@ -23,7 +21,7 @@ testAndroid(RuntimeStub stub) {
2321
ms = currentTimeMillis();
2422
bool resultBool = stub.getBool(true);
2523
use = currentTimeMillis() - ms;
26-
print('getBool result:$resultBool');
24+
print('getBool result:$resultBool , cost:$use');
2725

2826
ms = currentTimeMillis();
2927
double resultFloat = stub.getFloat(10.5);
@@ -48,14 +46,7 @@ testAndroid(RuntimeStub stub) {
4846
ms = currentTimeMillis();
4947
String resultString = stub.getString("test is success?");
5048
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-
//
49+
print('getString result:$resultString, cost:$use');
5950

6051
ms = currentTimeMillis();
6152
int resultAdd = stub.add(10, 20);
@@ -77,10 +68,6 @@ testAndroid(RuntimeStub stub) {
7768

7869
print('new entity get time : ${stub.getTime(new Entity())}');
7970

80-
stub.setDelegateListener(DelegateStub());
81-
82-
print("integer ${stub.getInteger()}");
83-
8471
List list = stub.getList([1, 2, 3, 4]);
8572
for (int item in list) {
8673
print("item $item");

dart_native/example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ packages:
168168
path: ".."
169169
relative: true
170170
source: path
171-
version: "0.3.19"
171+
version: "0.3.20"
172172
dart_native_gen:
173173
dependency: transitive
174174
description:

dart_native/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dart_native
22
description: Write native code using Dart. This package liberates you from native code and low performance channel.
3-
version: 0.3.19
3+
version: 0.3.20
44
homepage: https://github.com/dart-native/dart_native
55

66
environment:

0 commit comments

Comments
 (0)