BridgedClass class
Represents a natively defined class that is accessible to the interpreter.
BridgedClass allows native Dart classes to be used within interpreted code by providing metadata and adapters for constructors, methods, getters, and setters. This enables seamless integration between native and interpreted environments.
Example:
final bridgedString = BridgedClass(
String,
name: 'String',
constructors: {
'': StringConstructor(),
},
methods: {
'toLowerCase': StringToLowerCaseMethod(),
},
);
- Implemented types
Constructors
-
BridgedClass({required Type nativeType, required String name, int? typedefRequiredPositional, int? typedefMaxPositional, List<
String> ? nativeNames, int typeParameterCount = 0, bool canBeUsedAsMixin = false, bool isAbstract = false, int hierarchyDepth = 0, bool isAssignable(Object?)?, Map<String, BridgedConstructorCallable> constructors = const {}, Map<String, BridgedStaticMethodAdapter> staticMethods = const {}, Map<String, BridgedStaticGetterAdapter> staticGetters = const {}, Map<String, BridgedStaticSetterAdapter> staticSetters = const {}, Map<String, BridgedMethodAdapter> methods = const {}, Map<String, BridgedInstanceGetterAdapter> getters = const {}, Map<String, BridgedInstanceSetterAdapter> setters = const {}, Map<String, String> constructorSignatures = const {}, Map<String, String> methodSignatures = const {}, Map<String, String> staticMethodSignatures = const {}, Map<String, String> staticGetterSignatures = const {}, Map<String, String> staticSetterSignatures = const {}, Map<String, String> getterSignatures = const {}, Map<String, String> setterSignatures = const {}, bool isSubtypeOfFunc(BridgedClass other, {Object? value})?})
Properties
- canBeUsedAsMixin → bool
-
final
-
constructors
↔ Map<
String, BridgedConstructorCallable> -
getter/setter pair
-
constructorSignatures
↔ Map<
String, String> -
getter/setter pair
-
getters
↔ Map<
String, BridgedInstanceGetterAdapter> -
getter/setter pair
-
getterSignatures
↔ Map<
String, String> -
getter/setter pair
- hashCode → int
-
Must agree with operator ==, and therefore with nativeType, or a value
that compares equal still lands in a different bucket — which is precisely
the defect this pair fixes.
no setteroverride
- hierarchyDepth → int
-
GEN-115 (Phase 1) — Distance from
Objectin the native Dart inheritance hierarchy, i.e. the number of distinct supertypes (allSupertypes.length, excludingObjectitself).final - isAbstract → bool
-
Whether the bridged native class is
abstract(cannot be instantiated directly).final - isAssignable → bool Function(Object?)?
-
A function that determines if a native value can be assigned to this bridged type.
final
- isSubtypeOfFunc → bool Function(BridgedClass other, {Object? value})?
-
A function that determines if the current runtime type is a subtype of another runtime type.
final
-
methods
↔ Map<
String, BridgedMethodAdapter> -
getter/setter pair
-
methodSignatures
↔ Map<
String, String> -
getter/setter pair
- name → String
-
The name of this class as it appears in interpreted code.
final
-
nativeNames
→ List<
String> ? -
Additional native class names that should map to this bridged class.
This is essential for mapping Dart's internal implementation classes to their public interfaces.
final
- nativeType → Type
-
The native Dart type this bridge represents.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
setters
↔ Map<
String, BridgedInstanceSetterAdapter> -
getter/setter pair
-
setterSignatures
↔ Map<
String, String> -
getter/setter pair
-
staticGetters
↔ Map<
String, BridgedStaticGetterAdapter> -
getter/setter pair
-
staticGetterSignatures
↔ Map<
String, String> -
getter/setter pair
-
staticMethods
↔ Map<
String, BridgedStaticMethodAdapter> -
getter/setter pair
-
staticMethodSignatures
↔ Map<
String, String> -
getter/setter pair
-
staticSetters
↔ Map<
String, BridgedStaticSetterAdapter> -
getter/setter pair
-
staticSetterSignatures
↔ Map<
String, String> -
getter/setter pair
- typedefMaxPositional → int?
-
The most positional arguments the typedef may pass — required plus
optional. See typedefRequiredPositional.
final
- typedefRequiredPositional → int?
-
SCD137 — the positional arity of the FUNCTION TYPEDEF this bridge stands
for, when it stands for one.
nullon every other bridge, and on a typedef bridge generated before the generator carried the signature through — in which caseFunctionRuntimeType.isSubtypeOfkeeps scd136's arity-blind acceptance.final - typeParameterCount → int
-
final
Methods
-
findConstructorAdapter(
String name) → BridgedConstructorCallable? -
findInstanceGetterAdapter(
String name) → BridgedInstanceGetterAdapter? -
findInstanceMethodAdapter(
String name) → BridgedMethodAdapter? -
findInstanceSetterAdapter(
String name) → BridgedInstanceSetterAdapter? -
findStaticGetterAdapter(
String name) → BridgedStaticGetterAdapter? -
findStaticMethodAdapter(
String name) → BridgedStaticMethodAdapter? -
findStaticSetterAdapter(
String name) → BridgedStaticSetterAdapter? -
isSubtypeOf(
RuntimeType other, {Object? value}) → bool -
Checks if this type is a subtype of
other.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
SCD198 — a bare class name is a VALUE in a script, and it has to hash like
the
Typeit denotes.override
Static Methods
-
registerSupertypes(
Map< String, List< hierarchy) → voidString> > -
Register supertype relationships for bridged classes.
Each key is a class name, and the value is a list of its supertype names.
Example: {'StatelessWidget':
'Widget', 'DiagnosticableTree'} -
transitiveSupertypeNames(
String className) → List< String> -
Walk the registered supertype chain (transitively) starting from
classNameand return the full set of ancestor class names in breadth-first order. Used by interface-proxy resolution so an interpreted class likePanelTheme extends InheritedThemecan still match a proxy factory registered forInheritedWidgetup the chain. ExcludesclassNameitself.