dart_native_gen 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

dart_native_gen #

Annotation for dart_native.

Description #

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

Getting Started #

  1. Annotate a Dart wrapper class with @native.
@native
class RuntimeSon extends RuntimeStub {
  RuntimeSon([Class isa]) : super(Class('RuntimeSon'));
  RuntimeSon.fromPointer(Pointer<Void> ptr) : super.fromPointer(ptr);
}
  1. Annotate your own entry class with @nativeRoot:
@nativeRoot
void main() {
  runDartNativeExample();
  runApp(Platform.isAndroid ? AndroidNewApp() : IOSApp());
}
  1. just run the command below in your workspace build:
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

Installation #

add packages to dependencies in your pubspec.yaml example:

dependencies:
  dart_native_gen: any

[0.1.0] - Fix empty content. #

[0.0.6] - Fix runDartNative. #

[0.0.5] - Fix import. #

[0.0.4] - Fix import. #

[0.0.3] - Change annotation. #

[0.0.2] - Fix homepage. #

[0.0.1] - First release. #

  • Annotation for native class.

example/lib/main.dart

import 'package:dart_native_gen_example/main.dn.dart';
import 'package:dart_native_gen/dart_native_gen.dart';
@nativeRoot
void main() {
  runDartNativeGenExample();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dart_native_gen: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_native_gen/dart_native_gen.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
69
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • dart_native_gen that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

10 out of 10 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
analyzer ^0.39.4 0.39.12
build ^1.2.2 1.3.0
flutter 0.0.0
source_gen ^0.9.5 0.9.6
Transitive dependencies
_fe_analyzer_shared 5.0.0
args 1.6.0
async 2.4.2
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
dart_style 1.3.6
glob 1.2.0
html 0.14.0+3
js 0.6.2
logging 0.11.4
meta 1.1.8 1.2.2
node_interop 1.1.1
node_io 1.1.1
package_config 1.9.3
path 1.7.0
pedantic 1.9.0 1.9.2
pub_semver 1.4.4
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
watcher 0.9.7+15
yaml 2.2.1
Dev dependencies
build_runner any
flutter_test