BridgedExtensionDefinition class
Definition for a bridged native extension.
This is the generator-facing API for registering native Dart extensions with the D4rt interpreter. The buildInterpretedExtension method converts this definition into an InterpretedExtension that the runtime can use for extension method resolution.
Example (generated code):
BridgedExtensionDefinition(
name: 'StringHelpers',
onTypeName: 'String',
getters: {
'isPalindrome': (visitor, target) => (target as String) == (target as String).split('').reversed.join(),
},
methods: {
'repeat': (visitor, target, positional, named, typeArgs) {
return (target as String) * (positional[0] as int);
},
},
)
Constructors
-
BridgedExtensionDefinition({String? name, required String onTypeName, Map<
String, BridgedInstanceGetterAdapter> getters = const {}, Map<String, BridgedInstanceSetterAdapter> setters = const {}, Map<String, BridgedMethodAdapter> methods = const {}}) -
const
Properties
-
getters
→ Map<
String, BridgedInstanceGetterAdapter> -
Adapters for instance getters.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
methods
→ Map<
String, BridgedMethodAdapter> -
Adapters for instance methods.
final
- name → String?
-
The name of the extension (null for unnamed extensions).
final
- onTypeName → String
-
The name of the type this extension applies to (e.g., 'String', 'DateTime').
Resolved to a RuntimeType at registration time.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
setters
→ Map<
String, BridgedInstanceSetterAdapter> -
Adapters for instance setters.
final
Methods
-
buildInterpretedExtension(
RuntimeType onType) → InterpretedExtension - Builds an InterpretedExtension from this definition.
-
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 -
The equality operator.
inherited