dart_native_gen 0.1.2 copy "dart_native_gen: ^0.1.2" to clipboard
dart_native_gen: ^0.1.2 copied to clipboard

outdated

Automatic type conversion solution for dart_native based on source_gen through annotation.

dart_native_gen #

Annotation for dart_native.

Description #

Automatic type conversion solution for dart_native based on source_gen through annotation.

Getting Started #

  1. Add build_runner package to dev_dependencies in your pubspec.yaml.
dev_dependencies:
  # Add this line
  build_runner:
  1. Annotate a Dart wrapper class with @native. If this wrapper is generated by @dartnative/codegen, skip to next.
@native
class RuntimeSon extends RuntimeStub {
  RuntimeSon([Class isa]) : super(Class('RuntimeSon'));
  RuntimeSon.fromPointer(Pointer<Void> ptr) : super.fromPointer(ptr);
}
  1. Annotate your own entry(such asmain()) with @nativeRoot:
@nativeRoot
void main() {
  runApp(App());
}
  1. Run this command to generate files into your source directory:
flutter packages pub run build_runner build --delete-conflicting-outputs

Suggest you running the clean command before build:

flutter packages pub run build_runner clean
  1. Call function generated in xxx.dn.dart:
@nativeRoot
void main() {
  // Function name is generated by name in pubspec.yaml.
  runDartNativeExample(); 
  runApp(App());
}

Installation #

Add packages to dependencies in your pubspec.yaml example:

dependencies:
  dart_native_gen: any
3
likes
0
points
94
downloads

Publisher

unverified uploader

Weekly Downloads

Automatic type conversion solution for dart_native based on source_gen through annotation.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, flutter, source_gen

More

Packages that depend on dart_native_gen