Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
936dea28
Unverified
Commit
936dea28
authored
Oct 17, 2018
by
Alexandre Ardhuin
Committed by
GitHub
Oct 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable lint prefer_void_to_null (#23174)
* enable lint prefer_void_to_null * replace last Null by void
parent
7a63fac0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
16 additions
and
15 deletions
+16
-15
README.md
README.md
+1
-1
analysis_options.yaml
analysis_options.yaml
+1
-1
analyze-sample-code.dart
dev/bots/analyze-sample-code.dart
+1
-1
animation_controller.dart
packages/flutter/lib/src/animation/animation_controller.dart
+1
-1
tab_scaffold.dart
packages/flutter/lib/src/cupertino/tab_scaffold.dart
+1
-1
binding.dart
packages/flutter/lib/src/foundation/binding.dart
+1
-1
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+3
-3
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+2
-0
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+1
-2
localizations.dart
packages/flutter/lib/src/widgets/localizations.dart
+2
-2
gesture_detector_test.dart
packages/flutter/test/widgets/gesture_detector_test.dart
+1
-1
test_async_utils.dart
packages/flutter_test/lib/src/test_async_utils.dart
+1
-1
No files found.
README.md
View file @
936dea28
...
...
@@ -100,7 +100,7 @@ and access native features and SDKs on Android and iOS.
Accessing platform features is easy. Here is a snippet from our
<a
href=
"https://github.com/flutter/flutter/tree/master/examples/platform_channel"
>
interop example
</a>
:
```
dart
Future
<
Null
>
getBatteryLevel
()
async
{
Future
<
void
>
getBatteryLevel
()
async
{
var
batteryLevel
=
'unknown'
;
try
{
int
result
=
await
methodChannel
.
invokeMethod
(
'getBatteryLevel'
);
...
...
analysis_options.yaml
View file @
936dea28
...
...
@@ -136,7 +136,7 @@ linter:
-
prefer_iterable_whereType
-
prefer_single_quotes
-
prefer_typing_uninitialized_variables
# - prefer_void_to_null # not yet tested
-
prefer_void_to_null
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
-
recursive_getters
-
slash_for_doc_comments
...
...
dev/bots/analyze-sample-code.dart
View file @
936dea28
...
...
@@ -327,7 +327,7 @@ void processBlock(Line line, List<String> block, List<Section> sections) {
sections
.
add
(
Section
(
line
,
'dynamic expression
$_expressionId
= '
,
block
.
toList
(),
';'
));
}
else
if
(
block
.
first
.
startsWith
(
'await '
))
{
_expressionId
+=
1
;
sections
.
add
(
Section
(
line
,
'Future<
Null
> expression
$_expressionId
() async { '
,
block
.
toList
(),
' }'
));
sections
.
add
(
Section
(
line
,
'Future<
void
> expression
$_expressionId
() async { '
,
block
.
toList
(),
' }'
));
}
else
if
(
block
.
first
.
startsWith
(
'class '
)
||
block
.
first
.
startsWith
(
'enum '
))
{
sections
.
add
(
Section
(
line
,
null
,
block
.
toList
(),
null
));
}
else
if
((
block
.
first
.
startsWith
(
'_'
)
||
block
.
first
.
startsWith
(
'final '
))
&&
block
.
first
.
contains
(
' = '
))
{
...
...
packages/flutter/lib/src/animation/animation_controller.dart
View file @
936dea28
...
...
@@ -176,7 +176,7 @@ enum AnimationBehavior {
/// controllers using Dart's asynchronous syntax for awaiting [Future] objects:
///
/// ```dart
/// Future<
Null
> fadeOutAndUpdateState() async {
/// Future<
void
> fadeOutAndUpdateState() async {
/// try {
/// await fadeAnimationController.forward().orCancel;
/// await sizeAnimationController.forward().orCancel;
...
...
packages/flutter/lib/src/cupertino/tab_scaffold.dart
View file @
936dea28
...
...
@@ -45,7 +45,7 @@ import 'bottom_tab_bar.dart';
/// child: const Text('Next page'),
/// onPressed: () {
/// Navigator.of(context).push(
/// CupertinoPageRoute<
Null
>(
/// CupertinoPageRoute<
void
>(
/// builder: (BuildContext context) {
/// return CupertinoPageScaffold(
/// navigationBar: CupertinoNavigationBar(
...
...
packages/flutter/lib/src/foundation/binding.dart
View file @
936dea28
...
...
@@ -178,7 +178,7 @@ abstract class BindingBase {
assert
(
callback
!=
null
);
_lockCount
+=
1
;
final
Future
<
void
>
future
=
callback
();
assert
(
future
!=
null
,
'The lockEvents() callback returned null; it should return a Future<
Null
> that completes when the lock is to expire.'
);
assert
(
future
!=
null
,
'The lockEvents() callback returned null; it should return a Future<
void
> that completes when the lock is to expire.'
);
future
.
whenComplete
(()
{
_lockCount
-=
1
;
if
(!
locked
)
{
...
...
packages/flutter/lib/src/material/dialog.dart
View file @
936dea28
...
...
@@ -121,8 +121,8 @@ class Dialog extends StatelessWidget {
/// and returns a [Future] that completes when the dialog is dismissed.
///
/// ```dart
/// Future<
Null
> _neverSatisfied() async {
/// return showDialog<
Null
>(
/// Future<
void
> _neverSatisfied() async {
/// return showDialog<
void
>(
/// context: context,
/// barrierDismissible: false, // user must tap button!
/// builder: (BuildContext context) {
...
...
@@ -390,7 +390,7 @@ class SimpleDialogOption extends StatelessWidget {
/// that doesn't mention every value in the enum.
///
/// ```dart
/// Future<
Null
> _askedToLead() async {
/// Future<
void
> _askedToLead() async {
/// switch (await showDialog<Department>(
/// context: context,
/// builder: (BuildContext context) {
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
936dea28
...
...
@@ -93,6 +93,7 @@ abstract class PopupMenuEntry<T> extends StatefulWidget {
/// * [showMenu], a method to dynamically show a popup menu at a given location.
/// * [PopupMenuButton], an [IconButton] that automatically shows a menu when
/// it is tapped.
// ignore: prefer_void_to_null, https://github.com/dart-lang/sdk/issues/34416
class
PopupMenuDivider
extends
PopupMenuEntry
<
Null
>
{
/// Creates a horizontal divider for a popup menu.
///
...
...
@@ -106,6 +107,7 @@ class PopupMenuDivider extends PopupMenuEntry<Null> {
final
double
height
;
@override
// ignore: prefer_void_to_null, https://github.com/dart-lang/sdk/issues/34416
bool
represents
(
Null
value
)
=>
false
;
@override
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
936dea28
...
...
@@ -1076,14 +1076,13 @@ abstract class State<T extends StatefulWidget> extends Diagnosticable {
/// the increment is wrapped in the `setState`:
///
/// ```dart
/// Future<
Null
> _incrementCounter() async {
/// Future<
void
> _incrementCounter() async {
/// setState(() {
/// _counter++;
/// });
/// Directory directory = await getApplicationDocumentsDirectory();
/// final String dirName = directory.path;
/// await File('$dir/counter.txt').writeAsString('$_counter');
/// return null;
/// }
/// ```
///
...
...
packages/flutter/lib/src/widgets/localizations.dart
View file @
936dea28
...
...
@@ -14,7 +14,7 @@ import 'framework.dart';
// Examples can assume:
// class Intl { static String message(String s, { String name, String locale }) => ''; }
// Future<
Null
> initializeMessages(String locale) => null;
// Future<
void
> initializeMessages(String locale) => null;
// Used by loadAll() to record LocalizationsDelegate.load() futures we're
// waiting for.
...
...
@@ -308,7 +308,7 @@ class _LocalizationsScope extends InheritedWidget {
///
/// static Future<MyLocalizations> load(Locale locale) {
/// return initializeMessages(locale.toString())
/// .then((
Null
_) {
/// .then((
void
_) {
/// return MyLocalizations(locale);
/// });
/// }
...
...
packages/flutter/test/widgets/gesture_detector_test.dart
View file @
936dea28
...
...
@@ -334,7 +334,7 @@ void main() {
),
);
Future
<
Null
>
longPress
(
Duration
timeout
)
async
{
Future
<
void
>
longPress
(
Duration
timeout
)
async
{
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
400.0
,
50.0
));
await
tester
.
pump
(
timeout
);
await
gesture
.
up
();
...
...
packages/flutter_test/lib/src/test_async_utils.dart
View file @
936dea28
...
...
@@ -40,7 +40,7 @@ class _AsyncScope {
/// in a call to TestAsyncUtils.guard(), as follows:
///
/// ```dart
/// Future<
Null
> myTestFunction() => TestAsyncUtils.guard(() async {
/// Future<
void
> myTestFunction() => TestAsyncUtils.guard(() async {
/// // ...
/// });
/// ```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment