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
5a6bac30
Unverified
Commit
5a6bac30
authored
Mar 23, 2021
by
Jenn Magder
Committed by
GitHub
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate command_help to null safety (#78892)
parent
7f3c5deb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
61 deletions
+33
-61
command_help.dart
packages/flutter_tools/lib/src/base/command_help.dart
+33
-61
No files found.
packages/flutter_tools/lib/src/base/command_help.dart
View file @
5a6bac30
...
@@ -2,12 +2,8 @@
...
@@ -2,12 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'logger.dart'
;
import
'logger.dart'
;
import
'platform.dart'
;
import
'platform.dart'
;
import
'terminal.dart'
;
import
'terminal.dart'
;
...
@@ -21,10 +17,10 @@ const int maxLineWidth = 84;
...
@@ -21,10 +17,10 @@ const int maxLineWidth = 84;
/// Encapsulates the help text construction and printing.
/// Encapsulates the help text construction and printing.
class
CommandHelp
{
class
CommandHelp
{
CommandHelp
({
CommandHelp
({
@
required
Logger
logger
,
required
Logger
logger
,
@
required
AnsiTerminal
terminal
,
required
AnsiTerminal
terminal
,
@
required
Platform
platform
,
required
Platform
platform
,
@
required
OutputPreferences
outputPreferences
,
required
OutputPreferences
outputPreferences
,
})
:
_logger
=
logger
,
})
:
_logger
=
logger
,
_terminal
=
terminal
,
_terminal
=
terminal
,
_platform
=
platform
,
_platform
=
platform
,
...
@@ -38,158 +34,134 @@ class CommandHelp {
...
@@ -38,158 +34,134 @@ class CommandHelp {
final
OutputPreferences
_outputPreferences
;
final
OutputPreferences
_outputPreferences
;
CommandHelpOption
_I
;
late
final
CommandHelpOption
I
=
_makeOption
(
CommandHelpOption
get
I
=>
_I
??=
_makeOption
(
'I'
,
'I'
,
'Toggle oversized image inversion
$image
.'
,
'Toggle oversized image inversion
$image
.'
,
'debugInvertOversizedImages'
,
'debugInvertOversizedImages'
,
);
);
CommandHelpOption
_L
;
late
final
CommandHelpOption
L
=
_makeOption
(
CommandHelpOption
get
L
=>
_L
??=
_makeOption
(
'L'
,
'L'
,
'Dump layer tree to the console.'
,
'Dump layer tree to the console.'
,
'debugDumpLayerTree'
,
'debugDumpLayerTree'
,
);
);
CommandHelpOption
_P
;
late
final
CommandHelpOption
P
=
_makeOption
(
CommandHelpOption
get
P
=>
_P
??=
_makeOption
(
'P'
,
'P'
,
'Toggle performance overlay.'
,
'Toggle performance overlay.'
,
'WidgetsApp.showPerformanceOverlay'
,
'WidgetsApp.showPerformanceOverlay'
,
);
);
CommandHelpOption
_R
;
late
final
CommandHelpOption
R
=
_makeOption
(
CommandHelpOption
get
R
=>
_R
??=
_makeOption
(
'R'
,
'R'
,
'Hot restart.'
,
'Hot restart.'
,
);
);
CommandHelpOption
_S
;
late
final
CommandHelpOption
S
=
_makeOption
(
CommandHelpOption
get
S
=>
_S
??=
_makeOption
(
'S'
,
'S'
,
'Dump accessibility tree in traversal order.'
,
'Dump accessibility tree in traversal order.'
,
'debugDumpSemantics'
,
'debugDumpSemantics'
,
);
);
CommandHelpOption
_U
;
late
final
CommandHelpOption
U
=
_makeOption
(
CommandHelpOption
get
U
=>
_U
??=
_makeOption
(
'U'
,
'U'
,
'Dump accessibility tree in inverse hit test order.'
,
'Dump accessibility tree in inverse hit test order.'
,
'debugDumpSemantics'
,
'debugDumpSemantics'
,
);
);
CommandHelpOption
_a
;
late
final
CommandHelpOption
a
=
_makeOption
(
CommandHelpOption
get
a
=>
_a
??=
_makeOption
(
'a'
,
'a'
,
'Toggle timeline events for all widget build methods.'
,
'Toggle timeline events for all widget build methods.'
,
'debugProfileWidgetBuilds'
,
'debugProfileWidgetBuilds'
,
);
);
CommandHelpOption
_b
;
late
final
CommandHelpOption
b
=
_makeOption
(
CommandHelpOption
get
b
=>
_b
??=
_makeOption
(
'b'
,
'b'
,
'Toggle the platform brightness setting (dark and light mode).'
,
'Toggle the platform brightness setting (dark and light mode).'
,
'debugBrightnessOverride'
,
'debugBrightnessOverride'
,
);
);
CommandHelpOption
_c
;
late
final
CommandHelpOption
c
=
_makeOption
(
CommandHelpOption
get
c
=>
_c
??=
_makeOption
(
'c'
,
'c'
,
'Clear the screen'
,
'Clear the screen'
,
);
);
CommandHelpOption
_d
;
late
final
CommandHelpOption
d
=
_makeOption
(
CommandHelpOption
get
d
=>
_d
??=
_makeOption
(
'd'
,
'd'
,
'Detach (terminate "flutter run" but leave application running).'
,
'Detach (terminate "flutter run" but leave application running).'
,
);
);
CommandHelpOption
_g
;
late
final
CommandHelpOption
g
=
_makeOption
(
CommandHelpOption
get
g
=>
_g
??=
_makeOption
(
'g'
,
'g'
,
'Run source code generators.'
'Run source code generators.'
);
);
CommandHelpOption
_h
;
late
final
CommandHelpOption
h
=
_makeOption
(
CommandHelpOption
get
h
=>
_h
??=
_makeOption
(
'h'
,
'h'
,
'Repeat this help message.'
,
'Repeat this help message.'
,
);
);
CommandHelpOption
_i
;
late
final
CommandHelpOption
i
=
_makeOption
(
CommandHelpOption
get
i
=>
_i
??=
_makeOption
(
'i'
,
'i'
,
'Toggle widget inspector.'
,
'Toggle widget inspector.'
,
'WidgetsApp.showWidgetInspectorOverride'
,
'WidgetsApp.showWidgetInspectorOverride'
,
);
);
CommandHelpOption
_o
;
late
final
CommandHelpOption
o
=
_makeOption
(
CommandHelpOption
get
o
=>
_o
??=
_makeOption
(
'o'
,
'o'
,
'Simulate different operating systems.'
,
'Simulate different operating systems.'
,
'defaultTargetPlatform'
,
'defaultTargetPlatform'
,
);
);
CommandHelpOption
_p
;
late
final
CommandHelpOption
p
=
_makeOption
(
CommandHelpOption
get
p
=>
_p
??=
_makeOption
(
'p'
,
'p'
,
'Toggle the display of construction lines.'
,
'Toggle the display of construction lines.'
,
'debugPaintSizeEnabled'
,
'debugPaintSizeEnabled'
,
);
);
CommandHelpOption
_q
;
late
final
CommandHelpOption
q
=
_makeOption
(
CommandHelpOption
get
q
=>
_q
??=
_makeOption
(
'q'
,
'q'
,
'Quit (terminate the application on the device).'
,
'Quit (terminate the application on the device).'
,
);
);
CommandHelpOption
_r
;
late
final
CommandHelpOption
r
=
_makeOption
(
CommandHelpOption
get
r
=>
_r
??=
_makeOption
(
'r'
,
'r'
,
'Hot reload.
$fire$fire$fire
'
,
'Hot reload.
$fire$fire$fire
'
,
);
);
CommandHelpOption
_s
;
late
final
CommandHelpOption
s
=
_makeOption
(
CommandHelpOption
get
s
=>
_s
??=
_makeOption
(
's'
,
's'
,
'Save a screenshot to flutter.png.'
,
'Save a screenshot to flutter.png.'
,
);
);
CommandHelpOption
_t
;
late
final
CommandHelpOption
t
=
_makeOption
(
CommandHelpOption
get
t
=>
_t
??=
_makeOption
(
't'
,
't'
,
'Dump rendering tree to the console.'
,
'Dump rendering tree to the console.'
,
'debugDumpRenderTree'
,
'debugDumpRenderTree'
,
);
);
CommandHelpOption
_v
;
late
final
CommandHelpOption
v
=
_makeOption
(
CommandHelpOption
get
v
=>
_v
??=
_makeOption
(
'v'
,
'v'
,
'Launch DevTools.'
,
'Launch DevTools.'
,
);
);
CommandHelpOption
_w
;
late
final
CommandHelpOption
w
=
_makeOption
(
CommandHelpOption
get
w
=>
_w
??=
_makeOption
(
'w'
,
'w'
,
'Dump widget hierarchy to the console.'
,
'Dump widget hierarchy to the console.'
,
'debugDumpApp'
,
'debugDumpApp'
,
);
);
CommandHelpOption
_z
;
late
final
CommandHelpOption
z
=
_makeOption
(
CommandHelpOption
get
z
=>
_z
??=
_makeOption
(
'z'
,
'z'
,
'Toggle elevation checker.'
,
'Toggle elevation checker.'
,
);
);
CommandHelpOption
_k
;
late
final
CommandHelpOption
k
=
_makeOption
(
CommandHelpOption
get
k
=>
_k
??=
_makeOption
(
'k'
,
'k'
,
'Toggle CanvasKit rendering.'
,
'Toggle CanvasKit rendering.'
,
);
);
CommandHelpOption
_M
;
late
final
CommandHelpOption
M
=
_makeOption
(
CommandHelpOption
get
M
=>
_M
??=
_makeOption
(
'M'
,
'M'
,
'Write SkSL shaders to a unique file in the project directory.'
,
'Write SkSL shaders to a unique file in the project directory.'
,
);
);
...
@@ -215,10 +187,10 @@ class CommandHelpOption {
...
@@ -215,10 +187,10 @@ class CommandHelpOption {
this
.
key
,
this
.
key
,
this
.
description
,
{
this
.
description
,
{
this
.
inParenthesis
=
''
,
this
.
inParenthesis
=
''
,
@
required
Logger
logger
,
required
Logger
logger
,
@
required
Terminal
terminal
,
required
Terminal
terminal
,
@
required
Platform
platform
,
required
Platform
platform
,
@
required
OutputPreferences
outputPreferences
,
required
OutputPreferences
outputPreferences
,
})
:
_logger
=
logger
,
})
:
_logger
=
logger
,
_terminal
=
terminal
,
_terminal
=
terminal
,
_platform
=
platform
,
_platform
=
platform
,
...
@@ -253,7 +225,7 @@ class CommandHelpOption {
...
@@ -253,7 +225,7 @@ class CommandHelpOption {
bool
wrap
=
false
;
bool
wrap
=
false
;
final
int
maxWidth
=
math
.
max
(
final
int
maxWidth
=
math
.
max
(
_outputPreferences
.
wrapColumn
??
0
,
_outputPreferences
.
wrapColumn
,
maxLineWidth
,
maxLineWidth
,
);
);
final
int
adjustedMessageLength
=
_platform
.
stdoutSupportsAnsi
final
int
adjustedMessageLength
=
_platform
.
stdoutSupportsAnsi
...
...
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