dart_native library

Classes

ArrayType
Block
byte
Stands for byte in Java.
CallBackManager
CATransform3D
Stands for CATransform3D in iOS and macOS.
CGAffineTransform
Stands for CGAffineTransform in iOS and macOS.
CGPoint
Stands for CGPoint in iOS and macOS.
CGRect
Stands for CGRect in iOS and macOS.
CGSize
Stands for CGSize in iOS and macOS.
CGVector
Stands for CGVector in iOS and macOS.
Class
Stands for Class in iOS and macOS.
Convertor
convertor info javaClass java class name, like java/lang/String convertor java object pointer to dart object function
CString
DirectByteBuffer
Stands for 'java/nio/DirectByteBuffer' in java. It's a more efficient way to use jni method direct get buffer info and create buffer.
DispatchQoS
Stands for DispatchQoS in iOS and macOS.
DispatchQueue
Stands for DispatchQueue in iOS and macOS. An object that manages the execution of tasks serially or concurrently on your app's main thread or on a background thread.
float
Stands for float in Java.
id
Stands for id in iOS and macOS.
Interface
A named interface for invoking platform methods directly with arguments.
JArray<E>
JArrayList<E>
JBoolean
JByte
jchar
Stands for char in Java.
JCharacter
JDouble
JFloat
JHashMap<K, V>
JHashSet<E>
JInteger
JList<E>
JLong
JMap<K, V>
JObject
Class JObject is the root of the java class hierarchy in dart. Every dart class need has JObject as a superclass. All objects, including arrays, invoke all native method use callMethodSync from this.
JSet<E>
JShort
long
Stands for long in Java.
NativeAvailable
Annotation for available API on native platforms.
NativeByte
Byte buffers representing each native platform.
NativeDeprecated
Annotation for deprecated API on native platforms.
NativeObject
The base class used to represent each platform/language object
NativePlatform
Type for unavailable platforms.
NativeUnavailable
Annotation for unavailable API on native platforms.
NSArray
Stands for NSArray in iOS and macOS.
NSData
Stands for NSData in iOS and macOS.
NSDictionary
Stands for NSDictionary in iOS and macOS.
NSDirectionalEdgeInsets
Stands for NSDirectionalEdgeInsets in iOS and macOS.
NSEdgeInsets
Stands for NSEdgeInsets in macOS.
NSError
Stands for NSError in iOS and macOS.
NSMutableArray
Stands for NSMutableArray in iOS and macOS.
NSMutableDictionary
Stands for NSMutableDictionary in iOS and macOS.
NSMutableSet
Stands for NSMutableSet in iOS and macOS.
NSMutableString
Stands for NSMutableString in iOS and macOS.
NSNotification
Stands for NSNotification in iOS and macOS.
NSNotificationCenter
NSNumber
Stands for NSNumber in iOS and macOS.
NSObject
Stands for NSObject in iOS and macOS.
NSObjectProtocol
Stands for @protocol NSObject in iOS and macOS.
NSObjectRef<T extends id>
Stands for NSObject ** in iOS and macOS.
NSPoint
Stands for NSPoint in macOS.
NSRange
Stands for NSRange in iOS and macOS.
NSRect
Stands for NSRect in macOS.
NSSet
Stands for NSSet in iOS and macOS.
NSSize
Stands for NSSize in macOS.
NSString
Stands for NSString in iOS and macOS.
NSValue
Stands for NSValue in iOS and macOS.
Protocol
Stands for Protocol and @protocol in iOS and macOS.
SEL
Stands for SEL and @selector in iOS and macOS.
short
Stands for short in Java.
UIEdgeInsets
Stands for UIEdgeInsets in iOS.
UIOffset
Stands for UIOffset in iOS.

Enums

Thread
When invoke with async method, dart can set run thread.

Extensions

CATransform3DAdditions on NSValue
ConvertToNSArray on List
ConvertToNSDictionary on Map
ConvertToNSSet on Set
ConvertToNSString on String
DartFinalizer on Object
JObjectCallMethod on JObject
call async extension simplify call function don't need return type's signature when calling native method
JObjectSyncCallMethod on JObject
call extension simplify call function don't need return type's signature when calling native method
NSValueGeometryExtensions on NSValue
NSValueRangeExtensions on NSValue
NSValueUIGeometryExtensions on NSValue
ToProtocol on String
ToSEL on String
Utf16Buffer on List<int>
Utf8String on char

Constants

android → const NativePlatform
API_TO_BE_DEPRECATED → const String
ios → const NativePlatform
macos → const NativePlatform
tvos → const NativePlatform
watchos → const NativePlatform

Properties

dispatch_async → void Function(Pointer<Void>, Pointer<Void>)
final
dispatch_get_global_queue Pointer<Void> Function(int, int)
final
dispatch_get_main_queue Pointer<Void> Function()
final
nil id
final
nilBlock Block
Stands for NSBlock in iOS and macOS. Block can be used as an argument to a method and as a callback.
final

Functions

alloc(Class? isa) Pointer<Void>
boxingWrapperClass(dynamic value) → dynamic
convertorForType(String type) ConvertorFromPointer?
Returns the ConvertorFromPointer function for type.
createNullJObj(String clsName) JObject
Use classname create a null pointer.
dartNativeInitCustomSoPath({String? soPath}) Future<void>
getRegisterJavaClass(String dartClass) String?
Get register java class name. if _convertorCache not contain this dartClass will return null.
getRegisterJavaClassSignature(String dartClass) String?
getRegisterPointerConvertor(String dartClass) ConvertorToDartFromPointer?
Get register pointer convert. if _convertorCache not contain this dartClass will return null.
jobjectInstanceFromPointer(String javaClass, dynamic arg) → dynamic
Convert pointer to jobject.
msgSend<T>(Pointer<Void> target, SEL selector, {List? args, DispatchQueue? onQueue}) Future<T>
Send a message to target on GCD queues asynchronously using onQueue. target should be an instance in iOS and macOS. onQueue is DispatchQueue.main by default.
msgSendSync<T>(Pointer<Void> target, SEL selector, {List? args, bool decodeRetVal = true}) → T
Send a message synchronously to target, which should be an instance in iOS and macOS.
objcInstanceFromPointer(Pointer<Void> arg, String? type) → dynamic
Convert arg to its custom type, which is annotated with @native().
registerCallback(dynamic target, Function function, String functionName) → void
When callback finish, you need to invoke unregisterCallback function by hand. OtherWise it will casue memory leak.
registerDartConvertor(String dartClass, String javaClass, ConvertorToDartFromPointer convertor) → void
See _dataConvertorCache definition.
registerJavaConvertor(String javaClass, ConvertorToDartFromPointer convertor) → void
See _javaConvertorCache definition.
registerJavaTypeConvertor(String dartClass, String javaClass, ConvertorToDartFromPointer convertor) → void
Register native class name and register a function for converting a Dart object from a Pointer.
registerProtocolCallback(dynamic target, Function callback, String selName, Type protocolType) bool
Register callback function for selector in protocol. Protocol protocolType must be used in native code. This function is only used for pure Dart class which implements a objc protocol.
registerTypeConvertor(String type, ConvertorFromPointer convertor) → void
Register a function for converting a Dart object from a Pointer.
runDartNative() → void
selector(String s) SEL
type({required dynamic of}) Class
Returns the class object for the receiver’s class.
unBoxingWrapperClass(dynamic value, String valueType) → dynamic
unregisterCallback(dynamic target) → void
Release callback in dart, c++ and java side.

Typedefs

BOOL = bool
These native types are ONLY for describing signatures of Objective-C Block.
CGFloat = double
char = int
Stands for char in C.
ConvertorFromPointer = dynamic Function(Pointer<Void> ptr)
ConvertorToDartFromPointer = dynamic Function(Pointer<Void> ptr)
Convert java object pointer to dart object which extends JObject.
DartFinalizerFunction = void Function()
DispatchWorkItem = void Function()
int16_t = int
Stands for int16_t in C.
int32_t = int
Stands for int32_t in C.
int64_t = int
Stands for int64_t in C.
int8_t = int
Stands for int8_t in C.
long_long = int
Stands for long long in C.
NativeDeprecatedReplacement = NativeDeprecated
NSEnum = int
Wrapper for Objective-C NS_ENUM
NSInteger = int
NSOptions = int
Wrapper for Objective-C NS_OPTIONS
NSUInteger = int
size_t = int
Stands for size_t in C.
uint16_t = int
Stands for uint16_t in C.
uint32_t = int
Stands for uint32_t in C.
uint64_t = int
Stands for uint64_t in C.
uint8_t = int
Stands for uint8_t in C.
unsigned_char = char
Stands for unsigned char in C.
unsigned_int = int
Stands for unsigned int in C.
unsigned_long = int
Stands for unsigned long in C.
unsigned_long_long = int
Stands for unsigned long long in C.
unsigned_short = int
Stands for unsigned short in C.