Enable avoid_print lint. (#91332)

This commit is contained in:
Ian Hickson
2021-10-07 09:53:03 -07:00
committed by GitHub
parent 3c6c2aa50a
commit cb378edc9e
85 changed files with 359 additions and 246 deletions

View File

@@ -47,7 +47,7 @@ class AutocompleteBasicExample extends StatelessWidget {
});
},
onSelected: (String selection) {
print('You just selected $selection');
debugPrint('You just selected $selection');
},
);
}

View File

@@ -79,7 +79,7 @@ class AutocompleteBasicUserExample extends StatelessWidget {
});
},
onSelected: (User selection) {
print('You just selected ${_displayStringForOption(selection)}');
debugPrint('You just selected ${_displayStringForOption(selection)}');
},
);
}

View File

@@ -35,7 +35,7 @@ class MyStatelessWidget extends StatelessWidget {
child: InkWell(
splashColor: Colors.blue.withAlpha(30),
onTap: () {
print('Card tapped.');
debugPrint('Card tapped.');
},
child: const SizedBox(
width: 300,

View File

@@ -59,7 +59,7 @@ class LinkedLabelCheckbox extends StatelessWidget {
),
recognizer: TapGestureRecognizer()
..onTap = () {
print('Label has been tapped.');
debugPrint('Label has been tapped.');
},
),
),

View File

@@ -45,7 +45,7 @@ class MyStatelessWidget extends StatelessWidget {
),
floatingActionButton: FloatingActionButton(
onPressed: () {
print('FAB pressed.');
debugPrint('FAB pressed.');
},
tooltip: 'Increment',
child: const Icon(Icons.add),

View File

@@ -34,7 +34,7 @@ class MyStatelessWidget extends StatelessWidget {
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: () {
print('Received click');
debugPrint('Received click');
},
child: const Text('Click Me'),
);

View File

@@ -64,7 +64,7 @@ class LinkedLabelRadio extends StatelessWidget {
),
recognizer: TapGestureRecognizer()
..onTap = () {
print('Label has been tapped.');
debugPrint('Label has been tapped.');
},
),
),

View File

@@ -59,7 +59,7 @@ class LinkedLabelSwitch extends StatelessWidget {
),
recognizer: TapGestureRecognizer()
..onTap = () {
print('Label has been tapped.');
debugPrint('Label has been tapped.');
},
),
),

View File

@@ -54,7 +54,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
constraints: BoxConstraints.tight(const Size(200, 50)),
child: TextFormField(
onSaved: (String? value) {
print('Value for field $index saved as "$value"');
debugPrint('Value for field $index saved as "$value"');
},
),
),

View File

@@ -92,13 +92,13 @@ class MyAction extends Action<MyIntent> {
@override
void addActionListener(ActionListenerCallback listener) {
super.addActionListener(listener);
print('Action Listener was added');
debugPrint('Action Listener was added');
}
@override
void removeActionListener(ActionListenerCallback listener) {
super.removeActionListener(listener);
print('Action Listener was removed');
debugPrint('Action Listener was removed');
}
@override

View File

@@ -34,7 +34,7 @@ class Model {
int save() {
if (isDirty.value) {
print('Saved Data: ${data.value}');
debugPrint('Saved Data: ${data.value}');
isDirty.value = false;
}
return data.value;

View File

@@ -57,21 +57,21 @@ class _ColorfulButtonState extends State<ColorfulButton> {
KeyEventResult _handleKeyPress(FocusNode node, RawKeyEvent event) {
if (event is RawKeyDownEvent) {
print('Focus node ${node.debugLabel} got key event: ${event.logicalKey}');
debugPrint('Focus node ${node.debugLabel} got key event: ${event.logicalKey}');
if (event.logicalKey == LogicalKeyboardKey.keyR) {
print('Changing color to red.');
debugPrint('Changing color to red.');
setState(() {
_color = Colors.red;
});
return KeyEventResult.handled;
} else if (event.logicalKey == LogicalKeyboardKey.keyG) {
print('Changing color to green.');
debugPrint('Changing color to green.');
setState(() {
_color = Colors.green;
});
return KeyEventResult.handled;
} else if (event.logicalKey == LogicalKeyboardKey.keyB) {
print('Changing color to blue.');
debugPrint('Changing color to blue.');
setState(() {
_color = Colors.blue;
});

View File

@@ -38,21 +38,21 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
KeyEventResult _handleKeyPress(FocusNode node, RawKeyEvent event) {
if (event is RawKeyDownEvent) {
print('Focus node ${node.debugLabel} got key event: ${event.logicalKey}');
debugPrint('Focus node ${node.debugLabel} got key event: ${event.logicalKey}');
if (event.logicalKey == LogicalKeyboardKey.keyR) {
print('Changing color to red.');
debugPrint('Changing color to red.');
setState(() {
_color = Colors.red;
});
return KeyEventResult.handled;
} else if (event.logicalKey == LogicalKeyboardKey.keyG) {
print('Changing color to green.');
debugPrint('Changing color to green.');
setState(() {
_color = Colors.green;
});
return KeyEventResult.handled;
} else if (event.logicalKey == LogicalKeyboardKey.keyB) {
print('Changing color to blue.');
debugPrint('Changing color to blue.');
setState(() {
_color = Colors.blue;
});

View File

@@ -115,7 +115,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
// This button would be not visible, but still focusable from
// the foreground pane without the FocusScope.
ElevatedButton(
onPressed: () => print('You pressed the other button!'),
onPressed: () => debugPrint('You pressed the other button!'),
child: const Text('ANOTHER BUTTON TO FOCUS'),
),
DefaultTextStyle(

View File

@@ -68,7 +68,7 @@ class _OrderedButtonState<T> extends State<OrderedButton<T>> {
void _handleOnPressed() {
focusNode.requestFocus();
print('Button ${widget.name} pressed.');
debugPrint('Button ${widget.name} pressed.');
debugDumpFocusTree();
}

View File

@@ -40,7 +40,7 @@ class DemoButton extends StatelessWidget {
final double order;
void _handleOnPressed() {
print('Button $name pressed.');
debugPrint('Button $name pressed.');
debugDumpFocusTree();
}

View File

@@ -122,10 +122,10 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> {
cellWidth: _cellWidth,
builder: (BuildContext context, int row, int column) {
if (!_isCellVisible(row, column, viewport)) {
print('removing cell ($row, $column)');
debugPrint('removing cell ($row, $column)');
return Container(height: _cellHeight);
}
print('building cell ($row, $column)');
debugPrint('building cell ($row, $column)');
return Container(
height: _cellHeight,
color: row % 2 + column % 2 == 1

View File

@@ -45,9 +45,9 @@ class MyStatelessWidget extends StatelessWidget {
body: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollNotification) {
if (scrollNotification is ScrollStartNotification) {
print('Scrolling has started');
debugPrint('Scrolling has started');
} else if (scrollNotification is ScrollEndNotification) {
print('Scrolling has ended');
debugPrint('Scrolling has ended');
}
// Return true to cancel the notification bubbling.
return true;