mirror of
https://github.com/flutter/packages.git
synced 2025-07-04 01:33:59 +08:00
[go_router_builder]update analyzer to 4.4.0 (#2429)
Update the analyzer to 4.4.0 as minimum version and remove the usage of deprecated APIs. Co-authored-by: stuartmorgan <stuartmorgan@google.com>
This commit is contained in:
@ -1,3 +1,8 @@
|
||||
## 1.0.8
|
||||
|
||||
* Updates `analyzer` to 4.4.0.
|
||||
* Removes the usage of deprecated API in `analyzer`.
|
||||
|
||||
## 1.0.7
|
||||
|
||||
* Supports newer versions of `analyzer`.
|
||||
|
@ -44,7 +44,7 @@ class RouteConfig {
|
||||
/// Creates a new [RouteConfig] represented the annotation data in [reader].
|
||||
factory RouteConfig.fromAnnotation(
|
||||
ConstantReader reader,
|
||||
ClassElement element,
|
||||
InterfaceElement element,
|
||||
) {
|
||||
final RouteConfig definition =
|
||||
RouteConfig._fromAnnotation(reader, element, null);
|
||||
@ -62,7 +62,7 @@ class RouteConfig {
|
||||
|
||||
factory RouteConfig._fromAnnotation(
|
||||
ConstantReader reader,
|
||||
ClassElement element,
|
||||
InterfaceElement element,
|
||||
RouteConfig? parent,
|
||||
) {
|
||||
assert(!reader.isNull, 'reader should not be null');
|
||||
@ -88,7 +88,7 @@ class RouteConfig {
|
||||
}
|
||||
|
||||
// TODO(kevmoo): validate that this MUST be a subtype of `GoRouteData`
|
||||
final ClassElement classElement = typeParamType.element;
|
||||
final InterfaceElement classElement = typeParamType.element2;
|
||||
|
||||
final RouteConfig value = RouteConfig._(path, classElement, parent);
|
||||
|
||||
@ -100,7 +100,7 @@ class RouteConfig {
|
||||
|
||||
final List<RouteConfig> _children = <RouteConfig>[];
|
||||
final String _path;
|
||||
final ClassElement _routeDataClass;
|
||||
final InterfaceElement _routeDataClass;
|
||||
final RouteConfig? _parent;
|
||||
|
||||
/// Generates all of the members that correspond to `this`.
|
||||
@ -363,11 +363,11 @@ GoRouteData.\$route(
|
||||
String _enumMapConst(InterfaceType type) {
|
||||
assert(type.isEnum);
|
||||
|
||||
final String enumName = type.element.name;
|
||||
final String enumName = type.element2.name;
|
||||
|
||||
final StringBuffer buffer = StringBuffer('const ${enumMapName(type)} = {');
|
||||
|
||||
for (final FieldElement enumField in type.element.fields
|
||||
for (final FieldElement enumField in type.element2.fields
|
||||
.where((FieldElement element) => !element.isSynthetic)) {
|
||||
buffer.writeln(
|
||||
'$enumName.${enumField.name}: ${escapeDartString(enumField.name.kebab)},',
|
||||
|
@ -79,7 +79,7 @@ String encodeField(PropertyAccessorElement element) {
|
||||
}
|
||||
|
||||
/// Gets the name of the `const` map generated to help encode [Enum] types.
|
||||
String enumMapName(InterfaceType type) => '_\$${type.element.name}EnumMap';
|
||||
String enumMapName(InterfaceType type) => '_\$${type.element2.name}EnumMap';
|
||||
|
||||
String _stateValueAccess(ParameterElement element) {
|
||||
if (element.isRequired) {
|
||||
|
@ -2,7 +2,7 @@ name: go_router_builder
|
||||
description: >-
|
||||
A builder that supports generated strongly-typed route helpers for
|
||||
package:go_router
|
||||
version: 1.0.7
|
||||
version: 1.0.8
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22
|
||||
|
||||
@ -11,7 +11,7 @@ environment:
|
||||
flutter: ">=3.0.0"
|
||||
|
||||
dependencies:
|
||||
analyzer: '>=2.7.0 <5.0.0'
|
||||
analyzer: '>=4.4.0 <5.0.0'
|
||||
async: ^2.8.0
|
||||
build: ^2.0.0
|
||||
build_config: ^1.0.0
|
||||
|
Reference in New Issue
Block a user