Skip to content

Commit 5175b01

Browse files
author
shaark
committed
issue-167. fixed after comments
1 parent bdbfca1 commit 5175b01

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

lib/src/lints/avoid_returning_widgets/models/avoid_returning_widgets_parameters.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

lib/src/models/exclude_params.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import 'package:analyzer/dart/ast/ast.dart';
22
import '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.
77
class 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(

lib/src/models/exclude_rule.dart renamed to lib/src/models/excluded_identifiers_parameter.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
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
);

0 commit comments

Comments
 (0)