Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Type Converters #65

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
fix mapping function parameter check
DevNico committed May 2, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 57c091748c6d2b27940aa73dcc130ddcad33f6a8
Original file line number Diff line number Diff line change
@@ -38,14 +38,14 @@ extension DartObjectExtension on DartObject {
return null;
}

if(function.parameters.length != 1) {
if(function.parameters.where((element) => element.isPositional).length != 1) {
throw InvalidGenerationSourceError(
'TypeConverter function must have exactly one parameter.',
'TypeConverter function must have exactly one required parameter positional parameter.',
element: function,
);
}

final sourceType = function.parameters.first.type;
final sourceType = function.parameters.firstWhere((element) => element.isPositional).type;
final targetType = function.returnType;

return TypeConversion(