/dart_native

Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.

Primary LanguageDart

dart_native

Write native code using Dart. This package liberates you from native code and low performance channel.

Still under development!!!

pub package Build Status

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

  1. dart_native README.md
  2. dart_native_gen README.md

TODO List

  • Unit test.
  • Documents.

Article