dart_native 0.6.2 copy "dart_native: ^0.6.2" to clipboard
dart_native: ^0.6.2 copied to clipboard

outdated

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

example/lib/main.dart

import 'package:dart_native_example/main.dn.dart';
import 'package:flutter/material.dart';
import 'package:dart_native_gen/dart_native_gen.dart';

import 'dn_unit_test.dart';

@nativeRoot
void main() {
  runDartNativeExample();
  runApp(const DartNativeApp());
}

class DartNativeApp extends StatefulWidget {
  const DartNativeApp({Key? key}) : super(key: key);

  @override
  State createState() => _DartNativeAppState();
}

class _DartNativeAppState extends State<DartNativeApp> {
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }
  String _text = 'Using DartNative';
  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    
    /// run all test case
    try {
      final unitTest = DNUnitTest();
      await unitTest.runAllUnitTests();
    } catch (e) {
      _text = e.toString();
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text(_text),
        ),
      ),
    );
  }
}
21
likes
0
pub points
69%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dart_native_gen, ffi, flutter

More

Packages that depend on dart_native