File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed
lints/avoid_returning_widgets/models Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ class AvoidReturningWidgetsParameters {
1515 factory AvoidReturningWidgetsParameters .fromJson (Map <String , dynamic > json) {
1616 return AvoidReturningWidgetsParameters (
1717 exclude: ExcludeParameters .fromJson (
18- excludeList: json['exclude' ] as Iterable ? ?? [],
18+ excludeList:
19+ json[ExcludeParameters .excludeParameterName] as Iterable ? ?? [],
1920 ),
2021 );
2122 }
Original file line number Diff line number Diff line change 11import 'package:analyzer/dart/ast/ast.dart' ;
22import 'package:collection/collection.dart' ;
3- import 'package:solid_lints/src/models/exclude_rule .dart' ;
3+ import 'package:solid_lints/src/models/excluded_identifiers_parameter .dart' ;
44
55/// A data model class that represents the "avoid returning widgets" input
66/// parameters.
77class ExcludeParameters {
88 /// A list of methods that should be excluded from the lint.
9- final List <ExcludeRule > exclude;
9+ final List <ExcludedIdentifiersParameter > exclude;
10+
11+ /// A json value name
12+ static const String excludeParameterName = 'exclude' ;
1013
1114 /// Constructor for [ExcludeParameters] model
1215 ExcludeParameters ({
@@ -17,11 +20,11 @@ class ExcludeParameters {
1720 factory ExcludeParameters .fromJson ({
1821 required Iterable <dynamic > excludeList,
1922 }) {
20- final exclude = < ExcludeRule > [];
23+ final exclude = < ExcludedIdentifiersParameter > [];
2124
2225 for (final item in excludeList) {
2326 if (item is Map ) {
24- exclude.add (ExcludeRule .fromJson (item));
27+ exclude.add (ExcludedIdentifiersParameter .fromJson (item));
2528 }
2629 }
2730 return ExcludeParameters (
Original file line number Diff line number Diff line change 11/// Model class for ExcludeRule parameters
2- class ExcludeRule {
2+ class ExcludedIdentifiersParameter {
33 /// The name of the method that should be excluded from the lint.
44 final String methodName;
55
66 /// The name of the class that should be excluded from the lint.
77 final String ? className;
88
9- /// Constructor for [ExcludeRule ] model
10- const ExcludeRule ({
9+ /// Constructor for [ExcludedIdentifiersParameter ] model
10+ const ExcludedIdentifiersParameter ({
1111 required this .methodName,
1212 required this .className,
1313 });
1414
1515 ///
16- factory ExcludeRule .fromJson (
16+ factory ExcludedIdentifiersParameter .fromJson (
1717 Map <dynamic , dynamic > json,
1818 ) {
19- return ExcludeRule (
19+ return ExcludedIdentifiersParameter (
2020 methodName: json['method_name' ] as String ,
2121 className: json['class_name' ] as String ? ,
2222 );
You can’t perform that action at this time.
0 commit comments