A native runtime plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and call native runtime.
- Access class with name.
- Access global instance with name.
- Call method with method name and arguments.
- Read and write property with property name.
To use this plugin, add flutter_native_runtime
as a dependency in your pubspec.yaml file. For example:
dependencies:
flutter_native_runtime: 0.0.1
import 'package:flutter_native_runtime/flutter_native_runtime.dart';
// Class target for ios
final deviceTarget = nativeRuntime.classNamed('UIDevice');
// Instance target for ios
final deviceTarget = nativeRuntime.instanceNamed('UIDevice');
// Class target for android
final registrarTarget = nativeRuntime.classNamed('Registrar');
// Instance type for android
final registrarTarget = nativeRuntime.instanceNamed('Registrar');
import 'package:flutter_native_runtime/flutter_native_runtime.dart';
// iOS
// Access property to get result of UIDevice.currentDevice.systemVersion
final systemVersion = nativeRuntime.classNamed('UIDevice').property('currentDevice').property('systemVersion').get<String>();
// Access method to get result of [[UIDevice currentDevice] systemVersion]
final systemVersion = nativeRuntime.classNamed('UIDevice').method('currentDevice').method('systemVersion').invoke<String>();
// Access method to get result of [UIDevice currentDevice].systemVersion
final systemVersion = nativeRuntime.classNamed('UIDevice').method('currentDevice').property('systemVersion').get<String>();
// Android
// To get Context.getPackageName
final packageName = nativeRuntime.instanceNamed('Registrar').method('context').method('getPackageName').invoke<String>();
// To get private variable of Context.mVariable
final variable = nativeRuntime.instanceNamed('Registrar').property('context').variable('mVariable').invoke<String>();
Please file any issues, bugs or feature request as an issue on our Github page.
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.
This Flutter Native Runtime plugin for Flutter is developed by modool. You can contact us at [email protected]