native_revolution 0.0.2 copy "native_revolution: ^0.0.2" to clipboard
native_revolution: ^0.0.2 copied to clipboard

Revolution FFI NATIVE

example/lib/main.dart

import 'dart:ffi';
import 'dart:io';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:native_revolution/native_revolution.dart';

void main() {
  runApp(MyApp());
}


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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int result = 0;
  static const MethodChannel _channel = MethodChannel('native_revolution');
  final DynamicLibrary nativeAddLib = Platform.isAndroid
        ? DynamicLibrary.open('libnative_revolution.so')
        : DynamicLibrary.process();
  String _platformVersion = 'Unknown';
  int counter = 0;
  
  
  _cobaNativ(int firstnum, int secondnum){
    final int Function(int x, int y) nativeAdd = nativeAddLib
        .lookup<NativeFunction<Int32 Function(Int32, Int32)>>('native_add')
        .asFunction();
    
    result = nativeAdd(firstnum,secondnum);
    return result;
  }
     
  @override
  void initState() {
    // TODO: implement initState
    _cobaNativ(5, 10);
    super.initState();
  }
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
         body: Column(
           children: [
             SizedBox(
              height: 100,
              width: double.infinity,
        child: Text("INI HASIL TESTING FFI : $result"),
        ),
           ],
         ),
      ),
    );
  }
}
0
likes
130
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

Revolution FFI NATIVE

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on native_revolution