ImportedType class

An imported type which will be used in the generated code.

Constructors

ImportedType(LibraryImport libraryImport, String cType, String dartType, String nativeType, {String? defaultValue, bool importedDartType = false})

Properties

baseArrayType → Type
Get base Array type.
no setterinherited
baseType → Type
Get base type for any type.
no setterinherited
cType String
final
dartType String
final
defaultValue String?
final
hashCode int
The hash code for this object.
no setterinherited
importedDartType bool
Whether the dartType is an import from the libraryImport.
final
isIncompleteCompound bool
Returns true if the type is a Compound and is incomplete.
no setterinherited
libraryImport LibraryImport
final
nativeType String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sameDartAndCType bool
Returns whether the dart type and C type string are same.
no setterinherited
sameDartAndFfiDartType bool
Returns whether the dart type and FFI dart type string are same.
no setterinherited
sameFfiDartAndCType bool
Returns whether the FFI dart type and C type string are same.
no setter
typealiasType → Type
Get base typealias type.
no setterinherited

Methods

cacheKey() String
Cache key used in various places to dedupe Types. By default this is just the hash of the Type, but in many cases this does not dedupe sufficiently. So Types that may be duplicated should override this to return a more specific key. Types that are already deduped don't need to override this. toString() is not a valid cache key as there may be name collisions.
inherited
convertDartTypeToFfiDartType(Context context, String value, {required bool objCRetain, required bool objCAutorelease}) String
Returns generated Dart code that converts the given value from its DartType to its FfiDartType.
inherited
convertFfiDartTypeToDartType(Context context, String value, {required bool objCRetain, String? objCEnclosingClass}) String
Returns generated Dart code that converts the given value from its FfiDartType to its DartType.
inherited
generateRetain(String value) String?
Returns generated ObjC code that retains a reference to the given value. Returns null if the Type does not need to be retained.
inherited
getCType(Context context) String
Returns the C type of the Type. This is the FFI compatible type that is passed to native code.
getDartType(Context context) String
Returns the user type of the Type. This is the type that is presented to users by the ffigened API to users. For C bindings this is always the same as getFfiDartType. For ObjC bindings this refers to the wrapper object.
inherited
getDefaultValue(Context context) String?
Returns a string of code that creates a default value for this type. For example, for int types this returns the string '0'. A null return means that default values aren't supported for this type, eg void.
getFfiDartType(Context context) String
Returns the Dart type of the Type. This is the type that is passed from FFI to Dart code.
getNativeType({String varName = ''}) String
Returns the C/ObjC type of the Type. This is the type as it appears in C/ObjC source code. It should not be used in Dart source code.
getObjCBlockSignatureType(Context context) String
Returns the type to be used if this type appears in an ObjC block signature. By default it's the same as getCType. But for some types that's not enough to distinguish them (eg all ObjC objects have a C type of Pointer<objc.ObjCObject>), so we use getDartType instead.
inherited
isSubtypeOf(Type other) bool
Returns true if this is a subtype of other. That is this <: other.
inherited
isSupertypeOf(Type other) bool
Returns true if this is a supertype of other. That is this :> other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a human readable string representation of the Type. This is mostly just for debugging, but it may also be used for non-functional code (eg to name a variable or type in generated code).
visit(Visitation visitation) → void
Visit this node. All this method does is delegate to the visit method that is specific to this type of node.
visitChildren(Visitor visitor) → void
Visit this node's children. This is the method that actually understands the structure of the node. It should invoke Visitor.visit etc on all the node's children.

Operators

operator ==(Object other) bool
The equality operator.
inherited