dart_native 0.1.9 copy "dart_native: ^0.1.9" to clipboard
dart_native: ^0.1.9 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/ios/delegatestub.dart';
import 'package:dart_native_example/ios/runtimestub.dart';
import 'package:dart_native_example/ios/unit_test.dart';
import 'package:flutter/material.dart';
import 'dart:async';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  RuntimeStub stub = RuntimeStub().retain();
  DelegateStub delegate = DelegateStub().retain();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    testIOS(stub, delegate);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Using DartNative\n'),
        ),
      ),
    );
  }

  @override
  void dispose() {
    stub.release();
    delegate.release();
    super.dispose();
  }
}
21
likes
0
pub points
78%
popularity

Publisher

unverified uploader

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

Homepage

License

unknown (LICENSE)

Dependencies

ffi, flutter

More

Packages that depend on dart_native