Skip to content

Commit 5cb36b8

Browse files
committed
chore: added flutter_linting for code analysis & linting
1 parent 39fb48c commit 5cb36b8

13 files changed

+20
-24
lines changed

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:flutter_lints/flutter.yaml
22

33
analyzer:
44
exclude:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:flutter_lints/flutter.yaml

packages/flutter_form_builder/lib/src/form_builder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class FormBuilderState extends State<FormBuilder> {
111111
// assistance to accidental duplicate names, we check and emit a warning.
112112
assert(() {
113113
if (_fields.containsKey(name)) {
114-
print('Warning! Replacing duplicate Field for $name'
114+
debugPrint('Warning! Replacing duplicate Field for $name'
115115
' -- this is OK to ignore as long as the field was intentionally replaced');
116116
}
117117
return true;
@@ -131,7 +131,7 @@ class FormBuilderState extends State<FormBuilder> {
131131
assert(() {
132132
// This is OK to ignore when you are intentionally replacing a field
133133
// with another field using the same name.
134-
print('Warning! Ignoring Field unregistration for $name'
134+
debugPrint('Warning! Ignoring Field unregistration for $name'
135135
' -- this is OK to ignore as long as the field was intentionally replaced');
136136
return true;
137137
}());

packages/flutter_form_builder/lib/src/form_builder_field.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ class FormBuilderFieldState<F extends FormBuilderField<T>, T>
161161
}
162162

163163
@override
164-
void didChange(T? val) {
165-
super.didChange(val);
164+
void didChange(T? value) {
165+
super.didChange(value);
166166
widget.onChanged?.call(value);
167167
}
168168

packages/flutter_form_builder/lib/src/widgets/grouped_checkbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class GroupedCheckbox<T> extends StatefulWidget {
179179

180180
final ControlAffinity controlAffinity;
181181

182-
GroupedCheckbox({
182+
const GroupedCheckbox({
183183
Key? key,
184184
required this.options,
185185
required this.orientation,

packages/flutter_form_builder/lib/src/widgets/grouped_radio.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ class GroupedRadio<T> extends StatefulWidget {
171171

172172
final ControlAffinity controlAffinity;
173173

174-
GroupedRadio({
174+
const GroupedRadio({
175+
Key? key,
175176
required this.options,
176177
required this.orientation,
177178
required this.onChanged,
@@ -191,7 +192,7 @@ class GroupedRadio<T> extends StatefulWidget {
191192
this.wrapVerticalDirection = VerticalDirection.down,
192193
this.separator,
193194
this.controlAffinity = ControlAffinity.leading,
194-
});
195+
}) : super(key: key);
195196

196197
@override
197198
_GroupedRadioState<T> createState() => _GroupedRadioState<T>();

packages/flutter_form_builder/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
intl: ^0.17.0
1313

1414
dev_dependencies:
15+
flutter_lints: ^1.0.4
1516
flutter_test:
1617
sdk: flutter
1718

packages/flutter_form_builder/test/flutter_form_builder_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void main() {
1313
name: textFieldName,
1414
builder: (FormFieldState<String?> field) {
1515
return InputDecorator(
16-
decoration: InputDecoration(),
16+
decoration: const InputDecoration(),
1717
child: TextField(
1818
onChanged: (value) => field.didChange(value),
1919
),

packages/flutter_form_builder/test/form_builder_checkbox_group_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ void main() {
1919

2020
expect(formSave(), isTrue);
2121
expect(formValue(widgetName), isNull);
22-
await tester.tap(find.byKey(ValueKey('1')));
22+
await tester.tap(find.byKey(const ValueKey('1')));
2323
await tester.pumpAndSettle();
2424
expect(formSave(), isTrue);
2525
expect(formValue(widgetName), equals(const [1]));
26-
await tester.tap(find.byKey(ValueKey('3')));
26+
await tester.tap(find.byKey(const ValueKey('3')));
2727
await tester.pumpAndSettle();
2828
expect(formSave(), isTrue);
2929
expect(formValue(widgetName), equals(const [1, 3]));

packages/flutter_form_builder/test/form_builder_choice_chips_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ void main() {
1919

2020
expect(formSave(), isTrue);
2121
expect(formValue(widgetName), isNull);
22-
await tester.tap(find.byKey(ValueKey('1')));
22+
await tester.tap(find.byKey(const ValueKey('1')));
2323
await tester.pumpAndSettle();
2424
expect(formSave(), isTrue);
2525
expect(formValue(widgetName), equals(1));
26-
await tester.tap(find.byKey(ValueKey('3')));
26+
await tester.tap(find.byKey(const ValueKey('3')));
2727
await tester.pumpAndSettle();
2828
expect(formSave(), isTrue);
2929
expect(formValue(widgetName), equals(3));

0 commit comments

Comments
 (0)