Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/go_router_builder/lib/src/route_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ abstract class RouteBaseConfig {
}

// TODO(kevmoo): validate that this MUST be a subtype of `GoRouteData`
// ignore: experimental_member_use
final InterfaceElement2 classElement = typeParamType.element3;

final RouteBaseConfig value;
Expand Down Expand Up @@ -945,6 +946,7 @@ String _enumMapConst(InterfaceType type) {

final StringBuffer buffer = StringBuffer('const ${enumMapName(type)} = {');

// ignore: experimental_member_use
for (final FieldElement2 enumField in type.element3.fields2.where(
(FieldElement2 element) => element.isEnumConstant,
)) {
Expand Down
11 changes: 10 additions & 1 deletion packages/go_router_builder/lib/src/type_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ bool _isStringToStringFunction(
/// Returns the custom codec for the annotation.
String? _getCustomCodec(ElementAnnotation annotation, String name) {
final ExecutableElement2? executableElement =
// ignore: experimental_member_use
annotation.computeConstantValue()?.getField(name)?.toFunctionValue2();
if (_isStringToStringFunction(executableElement, name)) {
return executableElement!.displayName;
Expand Down Expand Up @@ -188,10 +189,12 @@ T? getNodeDeclaration<T extends AstNode>(InterfaceElement2 element) {
}

final ParsedLibraryResult parsedLibrary =
// ignore: experimental_member_use
session.getParsedLibraryByElement2(element.library2)
as ParsedLibraryResult;
final FragmentDeclarationResult? declaration = parsedLibrary
.getFragmentDeclaration(element.firstFragment);
// ignore: experimental_member_use
.getFragmentDeclaration(element.firstFragment);
final AstNode? node = declaration?.node;

return node is T ? node : null;
Expand Down Expand Up @@ -684,6 +687,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper {

final MethodElement2? toJsonMethod = type.lookUpMethod3(
'toJson',
// ignore: experimental_member_use
type.element3.library2,
);
if (toJsonMethod == null ||
Expand All @@ -698,6 +702,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper {
return _matchesType(type.typeArguments.first);
}

// ignore: experimental_member_use
final ConstructorElement2? fromJsonMethod = type.element3
.getNamedConstructor2('fromJson');

Expand All @@ -711,6 +716,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper {
throw InvalidGenerationSourceError(
'The parameter type '
'`${type.getDisplayString(withNullability: false)}` not have a supported fromJson definition.',
// ignore: experimental_member_use
element: type.element3,
);
}
Expand Down Expand Up @@ -741,6 +747,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper {

bool _isNestedTemplate(InterfaceType type) {
// check if has fromJson constructor
// ignore: experimental_member_use
final ConstructorElement2? fromJsonMethod = type.element3
.getNamedConstructor2('fromJson');
if (fromJsonMethod == null || !fromJsonMethod.isPublic) {
Expand All @@ -764,6 +771,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper {
throw InvalidGenerationSourceError(
'The parameter type '
'`${type.getDisplayString(withNullability: false)}` not have a supported fromJson definition.',
// ignore: experimental_member_use
element: type.element3,
);
}
Expand All @@ -782,6 +790,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper {
throw InvalidGenerationSourceError(
'The parameter type '
'`${type.getDisplayString(withNullability: false)}` not have a supported fromJson definition.',
// ignore: experimental_member_use
element: type.element3,
);
}
Expand Down