dart_native
Write native code using Dart. This package liberates you from native code and low performance channel.
Still under development!!!
This is the blue part(DartNative Bridge) in the picture below:
Requirements
Flutter 1.12.13 (Dart 2.7.0)
Getting Started
Dart code:
// new Objective-C object.
RuntimeStub stub = RuntimeStub();
// Dart function will be converted to Objective-C block.
Block block = stub.fooBlock((NSObject a) {
print('hello block! ${a.toString()}');
return 101;
});
// invoke Objective-C block.
int result = block.invoke([stub]);
print(result);
// support built-in structs.
CGRect rect = stub.fooCGRect(CGRect(4, 3, 2, 1));
print(rect);
Objective-C code:
typedef int(^BarBlock)(NSObject *a);
@interface RuntimeStub
- (CGRect)fooCGRect:(CGRect)rect;
- (BarBlock)fooBlock:(BarBlock)block;
@end
Document
TODO List
- Unit test.
- Documents.