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
0d3b44e8
Unverified
Commit
0d3b44e8
authored
Aug 03, 2021
by
Jonah Williams
Committed by
GitHub
Aug 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter] replace 'checked mode' with 'debug mode' (#87408)
parent
6f9de0a9
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
58 additions
and
32 deletions
+58
-32
analyze.dart
dev/bots/analyze.dart
+26
-0
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+2
-2
binding.dart
packages/flutter/lib/src/foundation/binding.dart
+1
-1
app.dart
packages/flutter/lib/src/material/app.dart
+1
-1
decoration.dart
packages/flutter/lib/src/painting/decoration.dart
+1
-1
inline_span.dart
packages/flutter/lib/src/painting/inline_span.dart
+1
-1
text_span.dart
packages/flutter/lib/src/painting/text_span.dart
+1
-1
box.dart
packages/flutter/lib/src/rendering/box.dart
+2
-2
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+2
-2
object.dart
packages/flutter/lib/src/rendering/object.dart
+2
-2
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+2
-2
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+1
-1
app.dart
packages/flutter/lib/src/widgets/app.dart
+8
-8
banner.dart
packages/flutter/lib/src/widgets/banner.dart
+2
-2
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+1
-1
binding.dart
packages/flutter_test/lib/src/binding.dart
+2
-2
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+3
-3
No files found.
dev/bots/analyze.dart
View file @
0d3b44e8
...
...
@@ -48,6 +48,9 @@ Future<void> run(List<String> arguments) async {
print
(
'
$clock
runtimeType in toString...'
);
await
verifyNoRuntimeTypeInToString
(
flutterRoot
);
print
(
'
$clock
debug mode instead of checked mode...'
);
await
verifyNoCheckedMode
(
flutterRoot
);
print
(
'
$clock
Unexpected binaries...'
);
await
verifyNoBinaries
(
flutterRoot
);
...
...
@@ -471,6 +474,29 @@ Future<void> verifyInternationalizations(String workingDirectory, String dartExe
}
}
/// Verifies that all instances of "
checked
mode
" have been migrated to "
debug
mode
".
Future<void> verifyNoCheckedMode(String workingDirectory) async {
final String flutterPackages = path.join(workingDirectory, 'packages');
final List<File> files = await _allFiles(flutterPackages, 'dart', minimumMatches: 400)
.where((File file) => path.extension(file.path) == '.dart')
.toList();
final List<String> problems = <String>[];
for (final File file in files) {
int lineCount = 0;
for (final String line in file.readAsLinesSync()) {
if (line.toLowerCase().contains('checked mode')) {
problems.add('
${file.path}
:
$lineCount
uses deprecated "
checked
mode
" instead of "
debug
mode
".');
}
lineCount += 1;
}
}
if (problems.isNotEmpty) {
exitWithError(problems);
}
}
Future<void> verifyNoRuntimeTypeInToString(String workingDirectory) async {
final String flutterLib = path.join(workingDirectory, 'packages', 'flutter', 'lib');
final Set<String> excludedFiles = <String>{
...
...
packages/flutter/lib/src/foundation/assertions.dart
View file @
0d3b44e8
...
...
@@ -533,7 +533,7 @@ class FlutterErrorDetails with Diagnosticable {
/// dump this error to the console.
///
/// If this is true, then the default error handler would only dump this error
/// to the console in
checked
mode. In release mode, the error is ignored.
/// to the console in
debug
mode. In release mode, the error is ignored.
///
/// This is used by certain exception handlers that catch errors that could be
/// triggered by environmental conditions (as opposed to logic errors). For
...
...
@@ -950,7 +950,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti
assert
(
details
.
exception
!=
null
);
bool
isInDebugMode
=
false
;
assert
(()
{
// In
checked
mode, we ignore the "silent" flag.
// In
debug
mode, we ignore the "silent" flag.
isInDebugMode
=
true
;
return
true
;
}());
...
...
packages/flutter/lib/src/foundation/binding.dart
View file @
0d3b44e8
...
...
@@ -33,7 +33,7 @@ typedef ServiceExtensionCallback = Future<Map<String, dynamic>> Function(Map<Str
/// To use this class in an `on` clause of a mixin, inherit from it and implement
/// [initInstances()]. The mixin is guaranteed to only be constructed once in
/// the lifetime of the app (more precisely, it will assert if constructed twice
/// in
checked
mode).
/// in
debug
mode).
///
/// The top-most layer used to write the application will have a concrete class
/// that inherits from [BindingBase] and uses all the various [BindingBase]
...
...
packages/flutter/lib/src/material/app.dart
View file @
0d3b44e8
...
...
@@ -660,7 +660,7 @@ class MaterialApp extends StatefulWidget {
/// Turns on a [GridPaper] overlay that paints a baseline grid
/// Material apps.
///
/// Only available in
checked
mode.
/// Only available in
debug
mode.
///
/// See also:
///
...
...
packages/flutter/lib/src/painting/decoration.dart
View file @
0d3b44e8
...
...
@@ -29,7 +29,7 @@ abstract class Decoration with Diagnosticable {
@override
String
toStringShort
()
=>
objectRuntimeType
(
this
,
'Decoration'
);
/// In
checked
mode, throws an exception if the object is not in a
/// In
debug
mode, throws an exception if the object is not in a
/// valid configuration. Otherwise, returns true.
///
/// This is intended to be used as follows:
...
...
packages/flutter/lib/src/painting/inline_span.dart
View file @
0d3b44e8
...
...
@@ -331,7 +331,7 @@ abstract class InlineSpan extends DiagnosticableTree {
@protected
int
?
codeUnitAtVisitor
(
int
index
,
Accumulator
offset
);
/// In
checked
mode, throws an exception if the object is not in a
/// In
debug
mode, throws an exception if the object is not in a
/// valid configuration. Otherwise, returns true.
///
/// This is intended to be used as follows:
...
...
packages/flutter/lib/src/painting/text_span.dart
View file @
0d3b44e8
...
...
@@ -432,7 +432,7 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
offset
.
increment
(
text
!=
null
?
text
!.
length
:
0
);
}
/// In
checked
mode, throws an exception if the object is not in a valid
/// In
debug
mode, throws an exception if the object is not in a valid
/// configuration. Otherwise, returns true.
///
/// This is intended to be used as follows:
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
0d3b44e8
...
...
@@ -497,7 +497,7 @@ class BoxConstraints extends Constraints {
///
/// Most of the APIs on BoxConstraints expect the constraints to be
/// normalized and have undefined behavior when they are not. In
///
checked
mode, many of these APIs will assert if the constraints
///
debug
mode, many of these APIs will assert if the constraints
/// are not normalized.
@override
bool
get
isNormalized
{
...
...
@@ -1951,7 +1951,7 @@ abstract class RenderBox extends RenderObject {
return
_size
!;
}
Size
?
_size
;
/// Setting the size, in
checked
mode, triggers some analysis of the render box,
/// Setting the size, in
debug
mode, triggers some analysis of the render box,
/// as implemented by [debugAssertDoesMeetConstraints], including calling the intrinsic
/// sizing methods and checking that they meet certain invariants.
@protected
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
0d3b44e8
...
...
@@ -36,7 +36,7 @@ bool debugPaintLayerBordersEnabled = false;
/// [RenderBox.debugHandleEvent].
bool
debugPaintPointersEnabled
=
false
;
/// Overlay a rotating set of colors when repainting layers in
checked
mode.
/// Overlay a rotating set of colors when repainting layers in
debug
mode.
///
/// See also:
///
...
...
@@ -44,7 +44,7 @@ bool debugPaintPointersEnabled = false;
/// areas are being excessively repainted.
bool
debugRepaintRainbowEnabled
=
false
;
/// Overlay a rotating set of colors when repainting text in
checked
mode.
/// Overlay a rotating set of colors when repainting text in
debug
mode.
bool
debugRepaintTextRainbowEnabled
=
false
;
/// The current color to overlay when repainting a layer.
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
0d3b44e8
...
...
@@ -1879,7 +1879,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// If a subclass has a "size" (the state controlled by `parentUsesSize`,
/// whatever it is in the subclass, e.g. the actual `size` property of
/// [RenderBox]), and the subclass verifies that in
checked
mode this "size"
/// [RenderBox]), and the subclass verifies that in
debug
mode this "size"
/// property isn't used when [debugCanParentUseSize] isn't set, then that
/// subclass should override [debugResetSize] to reapply the current values of
/// [debugCanParentUseSize] to that state.
...
...
@@ -2023,7 +2023,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// See [RepaintBoundary] for more information about how repaint boundaries function.
bool
get
isRepaintBoundary
=>
false
;
/// Called, in
checked
mode, if [isRepaintBoundary] is true, when either the
/// Called, in
debug
mode, if [isRepaintBoundary] is true, when either the
/// this render object or its parent attempt to paint.
///
/// This can be used to record metrics about whether the node should actually
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
0d3b44e8
...
...
@@ -3075,7 +3075,7 @@ class RenderMouseRegion extends RenderProxyBox implements MouseTrackerAnnotation
/// application and the rest of the application would not repaint.
///
/// To tell if a particular RenderRepaintBoundary is useful, run your
/// application in
checked
mode, interacting with it in typical ways, and then
/// application in
debug
mode, interacting with it in typical ways, and then
/// call [debugDumpRenderTree]. Each RenderRepaintBoundary will include the
/// ratio of cases where the repaint boundary was useful vs the cases where it
/// was not. These counts can also be inspected programmatically using
...
...
@@ -3237,7 +3237,7 @@ class RenderRepaintBoundary extends RenderProxyBox {
return
true
;
}());
if
(
inReleaseMode
)
properties
.
add
(
DiagnosticsNode
.
message
(
'(run in
checked
mode to collect repaint boundary statistics)'
));
properties
.
add
(
DiagnosticsNode
.
message
(
'(run in
debug
mode to collect repaint boundary statistics)'
));
}
}
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
0d3b44e8
...
...
@@ -385,7 +385,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
}
/// Throws an exception saying that the object does not support returning
/// intrinsic dimensions if, in
checked
mode, we are not in the
/// intrinsic dimensions if, in
debug
mode, we are not in the
/// [RenderObject.debugCheckingIntrinsics] mode.
///
/// This is used by [computeMinIntrinsicWidth] et al because viewports do not
...
...
packages/flutter/lib/src/widgets/app.dart
View file @
0d3b44e8
...
...
@@ -245,7 +245,7 @@ typedef InitialRouteListFactory = List<Route<dynamic>> Function(String initialRo
/// See also:
///
/// * [CheckedModeBanner], which displays a [Banner] saying "DEBUG" when
/// running in
checked
mode.
/// running in
debug
mode.
/// * [DefaultTextStyle], the text style to apply to descendant [Text] widgets
/// without an explicit style.
/// * [MediaQuery], which establishes a subtree in which media queries resolve
...
...
@@ -967,9 +967,9 @@ class WidgetsApp extends StatefulWidget {
/// Turns on an overlay that enables inspecting the widget tree.
///
/// The inspector is only available in
checked
mode as it depends on
/// The inspector is only available in
debug
mode as it depends on
/// [RenderObject.debugDescribeChildren] which should not be called outside of
///
checked
mode.
///
debug
mode.
final
bool
debugShowWidgetInspector
;
/// Builds the widget the [WidgetInspector] uses to switch between view and
...
...
@@ -981,18 +981,18 @@ class WidgetsApp extends StatefulWidget {
final
InspectorSelectButtonBuilder
?
inspectorSelectButtonBuilder
;
/// {@template flutter.widgets.widgetsApp.debugShowCheckedModeBanner}
/// Turns on a little "DEBUG" banner in
checked
mode to indicate
/// that the app is in
checked
mode. This is on by default (in
///
checked
mode), to turn it off, set the constructor argument to
/// Turns on a little "DEBUG" banner in
debug
mode to indicate
/// that the app is in
debug
mode. This is on by default (in
///
debug
mode), to turn it off, set the constructor argument to
/// false. In release mode this has no effect.
///
/// To get this banner in your application if you're not using
/// WidgetsApp, include a [CheckedModeBanner] widget in your app.
///
/// This banner is intended to deter people from complaining that your
/// app is slow when it's in
checked mode. In checked
mode, Flutter
/// app is slow when it's in
debug mode. In debug
mode, Flutter
/// enables a large number of expensive diagnostics to aid in
/// development, and so performance in
checked
mode is not
/// development, and so performance in
debug
mode is not
/// representative of what will happen in release mode.
/// {@endtemplate}
final
bool
debugShowCheckedModeBanner
;
...
...
packages/flutter/lib/src/widgets/banner.dart
View file @
0d3b44e8
...
...
@@ -325,11 +325,11 @@ class Banner extends StatelessWidget {
}
}
/// Displays a [Banner] saying "DEBUG" when running in
checked
mode.
/// Displays a [Banner] saying "DEBUG" when running in
debug
mode.
/// [MaterialApp] builds one of these by default.
/// Does nothing in release mode.
class
CheckedModeBanner
extends
StatelessWidget
{
/// Creates a const
checked
mode banner.
/// Creates a const
debug
mode banner.
const
CheckedModeBanner
({
Key
?
key
,
required
this
.
child
,
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
0d3b44e8
...
...
@@ -2087,7 +2087,7 @@ abstract class BuildContext {
/// This getter will only return a valid result if [findRenderObject] actually
/// returns a [RenderBox]. If [findRenderObject] returns a render object that
/// is not a subtype of [RenderBox] (e.g., [RenderView]), this getter will
/// throw an exception in
checked
mode and will return null in release mode.
/// throw an exception in
debug
mode and will return null in release mode.
///
/// Calling this getter is theoretically relatively expensive (O(N) in the
/// depth of the tree), but in practice is usually cheap because the tree
...
...
packages/flutter_test/lib/src/binding.dart
View file @
0d3b44e8
...
...
@@ -951,8 +951,8 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
/// This binding controls time, allowing tests to verify long
/// animation sequences without having to execute them in real time.
///
/// This class assumes it is always run in
checked
mode (since tests are always
/// run in
checked
mode).
/// This class assumes it is always run in
debug
mode (since tests are always
/// run in
debug
mode).
class
AutomatedTestWidgetsFlutterBinding
extends
TestWidgetsFlutterBinding
{
@override
void
initInstances
()
{
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
0d3b44e8
...
...
@@ -393,15 +393,15 @@ const String kDebugWarning = '''
/// passed to the `callback`, and that handle will automatically be disposed
/// after the callback is finished.
///
/// Benchmarks must not be run in
checked
mode, because the performance is not
/// Benchmarks must not be run in
debug
mode, because the performance is not
/// representative. To avoid this, this function will print a big message if it
/// is run in
checked
mode. Unit tests of this method pass `mayRunWithAsserts`,
/// is run in
debug
mode. Unit tests of this method pass `mayRunWithAsserts`,
/// but it should not be used for actual benchmarking.
///
/// Example:
///
/// main() async {
/// assert(false); // fail in
checked
mode
/// assert(false); // fail in
debug
mode
/// await benchmarkWidgets((WidgetTester tester) async {
/// await tester.pumpWidget(MyWidget());
/// final Stopwatch timer = Stopwatch()..start();
...
...
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