validateCallbackParam static method
void
validateCallbackParam({})
Validates callback-related ctor params; throws LuaWidgetCodegenException.
Implementation
static void validateCallbackParam({
required String className,
required String paramName,
required String dartType,
required bool isFunctionType,
required bool isTypedefToFunction,
String? annotationKind,
required bool isEventPayloadMap,
}) {
if (isUnsupportedClosureType(
dartType: dartType,
isFunctionType: isFunctionType,
isTypedefToFunction: isTypedefToFunction,
)) {
throw LuaWidgetCodegenException(
closureParamError(
className: className,
paramName: paramName,
dartType: dartType,
),
);
}
if (annotationKind == 'LuaCallback' && !isEventPayloadMap) {
throw LuaWidgetCodegenException(
luaCallbackNonMapError(
className: className,
paramName: paramName,
dartType: dartType,
),
);
}
}