Skip to content

Commit

Permalink
wip: add support for custom converters
Browse files Browse the repository at this point in the history
  • Loading branch information
tnc1997 committed Feb 3, 2024
1 parent f83456d commit 6b49e8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xml_serializable/lib/src/extensions/element_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ extension ElementExtensions on Element {
/// Title? title;
/// }
/// ```
///
/// Throws a [StateError] if this element does not have an annotation that implements `XmlConverter` and can convert the [type]. Returns `null` if the value of the annotation could not be computed because of errors.
DartObject? getXmlConverter({
DartType? type,
}) {
Expand All @@ -95,7 +97,7 @@ extension ElementExtensions on Element {
}
}

return null;
throw StateError("No element");
}

/// Gets the element that represents the class that can convert the [type] as an annotation on this element for example:
Expand Down

0 comments on commit 6b49e8f

Please sign in to comment.