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
7e3bef11
Commit
7e3bef11
authored
Mar 18, 2016
by
Hixie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace WidgetError and RenderingError with FlutterError
parent
5a141172
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
65 additions
and
58 deletions
+65
-58
debug.dart
packages/flutter/lib/src/material/debug.dart
+2
-2
box.dart
packages/flutter/lib/src/rendering/box.dart
+9
-9
custom_layout.dart
packages/flutter/lib/src/rendering/custom_layout.dart
+8
-8
grid.dart
packages/flutter/lib/src/rendering/grid.dart
+1
-1
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-10
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+3
-3
assertions.dart
packages/flutter/lib/src/services/assertions.dart
+23
-0
dismissable.dart
packages/flutter/lib/src/widgets/dismissable.dart
+1
-1
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+9
-16
gesture_detector.dart
packages/flutter/lib/src/widgets/gesture_detector.dart
+3
-3
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+1
-1
mimic.dart
packages/flutter/lib/src/widgets/mimic.dart
+1
-1
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+1
-1
overlay.dart
packages/flutter/lib/src/widgets/overlay.dart
+1
-1
navigator_test.dart
packages/flutter/test/widget/navigator_test.dart
+1
-1
No files found.
packages/flutter/lib/src/material/debug.dart
View file @
7e3bef11
...
@@ -11,7 +11,7 @@ bool debugCheckHasMaterial(BuildContext context) {
...
@@ -11,7 +11,7 @@ bool debugCheckHasMaterial(BuildContext context) {
assert
(()
{
assert
(()
{
if
(
context
.
widget
is
!
Material
&&
context
.
ancestorWidgetOfExactType
(
Material
)
==
null
)
{
if
(
context
.
widget
is
!
Material
&&
context
.
ancestorWidgetOfExactType
(
Material
)
==
null
)
{
Element
element
=
context
;
Element
element
=
context
;
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'No Material widget found.
\n
'
'No Material widget found.
\n
'
'
${context.widget.runtimeType}
widgets require a Material widget ancestor.
\n
'
'
${context.widget.runtimeType}
widgets require a Material widget ancestor.
\n
'
'In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter
\'
s material library, '
'In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter
\'
s material library, '
...
@@ -35,7 +35,7 @@ bool debugCheckHasScaffold(BuildContext context) {
...
@@ -35,7 +35,7 @@ bool debugCheckHasScaffold(BuildContext context) {
assert
(()
{
assert
(()
{
if
(
Scaffold
.
of
(
context
)
==
null
)
{
if
(
Scaffold
.
of
(
context
)
==
null
)
{
Element
element
=
context
;
Element
element
=
context
;
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'No Scaffold widget found.
\n
'
'No Scaffold widget found.
\n
'
'
${context.widget.runtimeType}
widgets require a Scaffold widget ancestor.
\n
'
'
${context.widget.runtimeType}
widgets require a Scaffold widget ancestor.
\n
'
'The specific widget that could not find a Scaffold ancestor was:
\n
'
'The specific widget that could not find a Scaffold ancestor was:
\n
'
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
7e3bef11
...
@@ -306,17 +306,17 @@ class BoxConstraints extends Constraints {
...
@@ -306,17 +306,17 @@ class BoxConstraints extends Constraints {
bool
get
debugAssertIsNormalized
{
bool
get
debugAssertIsNormalized
{
assert
(()
{
assert
(()
{
if
(
minWidth
<
0.0
&&
minHeight
<
0.0
)
if
(
minWidth
<
0.0
&&
minHeight
<
0.0
)
throw
new
Rendering
Error
(
'BoxConstraints has both a negative minimum width and a negative minimum height.
\n
$this
'
);
throw
new
Flutter
Error
(
'BoxConstraints has both a negative minimum width and a negative minimum height.
\n
$this
'
);
if
(
minWidth
<
0.0
)
if
(
minWidth
<
0.0
)
throw
new
Rendering
Error
(
'BoxConstraints has a negative minimum width.
\n
$this
'
);
throw
new
Flutter
Error
(
'BoxConstraints has a negative minimum width.
\n
$this
'
);
if
(
minHeight
<
0.0
)
if
(
minHeight
<
0.0
)
throw
new
Rendering
Error
(
'BoxConstraints has a negative minimum height.
\n
$this
'
);
throw
new
Flutter
Error
(
'BoxConstraints has a negative minimum height.
\n
$this
'
);
if
(
maxWidth
<
minWidth
&&
maxHeight
<
minHeight
)
if
(
maxWidth
<
minWidth
&&
maxHeight
<
minHeight
)
throw
new
Rendering
Error
(
'BoxConstraints has both width and height constraints non-normalized.
\n
$this
'
);
throw
new
Flutter
Error
(
'BoxConstraints has both width and height constraints non-normalized.
\n
$this
'
);
if
(
maxWidth
<
minWidth
)
if
(
maxWidth
<
minWidth
)
throw
new
Rendering
Error
(
'BoxConstraints has non-normalized width constraints.
\n
$this
'
);
throw
new
Flutter
Error
(
'BoxConstraints has non-normalized width constraints.
\n
$this
'
);
if
(
maxHeight
<
minHeight
)
if
(
maxHeight
<
minHeight
)
throw
new
Rendering
Error
(
'BoxConstraints has non-normalized height constraints.
\n
$this
'
);
throw
new
Flutter
Error
(
'BoxConstraints has non-normalized height constraints.
\n
$this
'
);
return
isNormalized
;
return
isNormalized
;
});
});
return
isNormalized
;
return
isNormalized
;
...
@@ -636,7 +636,7 @@ abstract class RenderBox extends RenderObject {
...
@@ -636,7 +636,7 @@ abstract class RenderBox extends RenderObject {
for
(
String
line
in
description
)
for
(
String
line
in
description
)
information
.
writeln
(
'
$line
'
);
information
.
writeln
(
'
$line
'
);
}
}
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'
$runtimeType
object was given an infinite size during layout.
\n
'
'
$runtimeType
object was given an infinite size during layout.
\n
'
'This probably means that it is a render object that tries to be
\n
'
'This probably means that it is a render object that tries to be
\n
'
'as big as possible, but it was put inside another render object
\n
'
'as big as possible, but it was put inside another render object
\n
'
...
@@ -647,7 +647,7 @@ abstract class RenderBox extends RenderObject {
...
@@ -647,7 +647,7 @@ abstract class RenderBox extends RenderObject {
}
}
// verify that the size is within the constraints
// verify that the size is within the constraints
if
(!
constraints
.
isSatisfiedBy
(
_size
))
{
if
(!
constraints
.
isSatisfiedBy
(
_size
))
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'
$runtimeType
does not meet its constraints.
\n
'
'
$runtimeType
does not meet its constraints.
\n
'
'Constraints:
$constraints
\n
'
'Constraints:
$constraints
\n
'
'Size:
$_size
\n
'
'Size:
$_size
\n
'
...
@@ -684,7 +684,7 @@ abstract class RenderBox extends RenderObject {
...
@@ -684,7 +684,7 @@ abstract class RenderBox extends RenderObject {
RenderObject
.
debugCheckingIntrinsics
=
false
;
RenderObject
.
debugCheckingIntrinsics
=
false
;
if
(
failures
.
isNotEmpty
)
{
if
(
failures
.
isNotEmpty
)
{
assert
(
failureCount
>
0
);
assert
(
failureCount
>
0
);
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The intrinsic dimension methods of the
$runtimeType
class returned values that violate the given constraints.
\n
'
'The intrinsic dimension methods of the
$runtimeType
class returned values that violate the given constraints.
\n
'
'The constraints were:
$constraints
\n
'
'The constraints were:
$constraints
\n
'
'The following method
${failureCount > 1 ? "s" : ""}
returned values outside of those constraints:
\n
'
'The following method
${failureCount > 1 ? "s" : ""}
returned values outside of those constraints:
\n
'
...
...
packages/flutter/lib/src/rendering/custom_layout.dart
View file @
7e3bef11
...
@@ -45,13 +45,13 @@ abstract class MultiChildLayoutDelegate {
...
@@ -45,13 +45,13 @@ abstract class MultiChildLayoutDelegate {
final
RenderBox
child
=
_idToChild
[
childId
];
final
RenderBox
child
=
_idToChild
[
childId
];
assert
(()
{
assert
(()
{
if
(
child
==
null
)
{
if
(
child
==
null
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate tried to lay out a non-existent child:
\n
'
'The
$this
custom multichild layout delegate tried to lay out a non-existent child:
\n
'
'There is no child with the id "
$childId
".'
'There is no child with the id "
$childId
".'
);
);
}
}
if
(!
_debugChildrenNeedingLayout
.
remove
(
child
))
{
if
(!
_debugChildrenNeedingLayout
.
remove
(
child
))
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate tried to lay out the child with id "
$childId
" more than once.
\n
'
'The
$this
custom multichild layout delegate tried to lay out the child with id "
$childId
" more than once.
\n
'
'Each child must be laid out exactly once.'
'Each child must be laid out exactly once.'
);
);
...
@@ -59,7 +59,7 @@ abstract class MultiChildLayoutDelegate {
...
@@ -59,7 +59,7 @@ abstract class MultiChildLayoutDelegate {
try
{
try
{
assert
(
constraints
.
debugAssertIsNormalized
);
assert
(
constraints
.
debugAssertIsNormalized
);
}
on
AssertionError
catch
(
exception
)
{
}
on
AssertionError
catch
(
exception
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate provided invalid box constraints for the child with id "
$childId
":
\n
'
'The
$this
custom multichild layout delegate provided invalid box constraints for the child with id "
$childId
":
\n
'
'
$exception
\n
'
'
$exception
\n
'
'The minimum width and height must be greater than or equal to zero.
\n
'
'The minimum width and height must be greater than or equal to zero.
\n
'
...
@@ -83,13 +83,13 @@ abstract class MultiChildLayoutDelegate {
...
@@ -83,13 +83,13 @@ abstract class MultiChildLayoutDelegate {
final
RenderBox
child
=
_idToChild
[
childId
];
final
RenderBox
child
=
_idToChild
[
childId
];
assert
(()
{
assert
(()
{
if
(
child
==
null
)
{
if
(
child
==
null
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate tried to position out a non-existent child:
\n
'
'The
$this
custom multichild layout delegate tried to position out a non-existent child:
\n
'
'There is no child with the id "
$childId
".'
'There is no child with the id "
$childId
".'
);
);
}
}
if
(
offset
==
null
)
{
if
(
offset
==
null
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate provided a null position for the child with id "
$childId
".'
'The
$this
custom multichild layout delegate provided a null position for the child with id "
$childId
".'
);
);
}
}
...
@@ -124,7 +124,7 @@ abstract class MultiChildLayoutDelegate {
...
@@ -124,7 +124,7 @@ abstract class MultiChildLayoutDelegate {
final
MultiChildLayoutParentData
childParentData
=
child
.
parentData
;
final
MultiChildLayoutParentData
childParentData
=
child
.
parentData
;
assert
(()
{
assert
(()
{
if
(
childParentData
.
id
==
null
)
{
if
(
childParentData
.
id
==
null
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The following child has no ID:
\n
'
'The following child has no ID:
\n
'
'
$child
\n
'
'
$child
\n
'
'Every child of a RenderCustomMultiChildLayoutBox must have an ID in its parent data.'
'Every child of a RenderCustomMultiChildLayoutBox must have an ID in its parent data.'
...
@@ -143,13 +143,13 @@ abstract class MultiChildLayoutDelegate {
...
@@ -143,13 +143,13 @@ abstract class MultiChildLayoutDelegate {
assert
(()
{
assert
(()
{
if
(
_debugChildrenNeedingLayout
.
isNotEmpty
)
{
if
(
_debugChildrenNeedingLayout
.
isNotEmpty
)
{
if
(
_debugChildrenNeedingLayout
.
length
>
1
)
{
if
(
_debugChildrenNeedingLayout
.
length
>
1
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate forgot to lay out the following children:
\n
'
'The
$this
custom multichild layout delegate forgot to lay out the following children:
\n
'
'
${_debugChildrenNeedingLayout.map(_debugDescribeChild).join("\n ")}
\n
'
'
${_debugChildrenNeedingLayout.map(_debugDescribeChild).join("\n ")}
\n
'
'Each child must be laid out exactly once.'
'Each child must be laid out exactly once.'
);
);
}
else
{
}
else
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$this
custom multichild layout delegate forgot to lay out the following child:
\n
'
'The
$this
custom multichild layout delegate forgot to lay out the following child:
\n
'
'
${_debugDescribeChild(_debugChildrenNeedingLayout.single)}
\n
'
'
${_debugDescribeChild(_debugChildrenNeedingLayout.single)}
\n
'
'Each child must be laid out exactly once.'
'Each child must be laid out exactly once.'
...
...
packages/flutter/lib/src/rendering/grid.dart
View file @
7e3bef11
...
@@ -399,7 +399,7 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
...
@@ -399,7 +399,7 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
void
set
mainAxis
(
Axis
value
)
{
void
set
mainAxis
(
Axis
value
)
{
assert
(()
{
assert
(()
{
if
(
value
!=
Axis
.
vertical
)
if
(
value
!=
Axis
.
vertical
)
throw
new
Rendering
Error
(
'RenderGrid doesn
\'
t yet support horizontal scrolling.'
);
throw
new
Flutter
Error
(
'RenderGrid doesn
\'
t yet support horizontal scrolling.'
);
return
true
;
return
true
;
});
});
super
.
mainAxis
=
value
;
super
.
mainAxis
=
value
;
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
7e3bef11
...
@@ -20,6 +20,7 @@ import 'binding.dart';
...
@@ -20,6 +20,7 @@ import 'binding.dart';
export
'package:flutter/gestures.dart'
show
HitTestEntry
,
HitTestResult
;
export
'package:flutter/gestures.dart'
show
HitTestEntry
,
HitTestResult
;
export
'package:flutter/painting.dart'
;
export
'package:flutter/painting.dart'
;
export
'package:flutter/services.dart'
show
FlutterError
;
/// Base class for data associated with a [RenderObject] by its parent.
/// Base class for data associated with a [RenderObject] by its parent.
///
///
...
@@ -2089,13 +2090,3 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
...
@@ -2089,13 +2090,3 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
return
result
;
return
result
;
}
}
}
}
/// Error thrown when the rendering library encounters a contract violation.
class
RenderingError
extends
AssertionError
{
RenderingError
(
this
.
message
);
final
String
message
;
@override
String
toString
()
=>
message
;
}
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
7e3bef11
...
@@ -441,7 +441,7 @@ class RenderAspectRatio extends RenderProxyBox {
...
@@ -441,7 +441,7 @@ class RenderAspectRatio extends RenderProxyBox {
assert
(
constraints
.
debugAssertIsNormalized
);
assert
(
constraints
.
debugAssertIsNormalized
);
assert
(()
{
assert
(()
{
if
(!
constraints
.
hasBoundedWidth
&&
!
constraints
.
hasBoundedHeight
)
{
if
(!
constraints
.
hasBoundedWidth
&&
!
constraints
.
hasBoundedHeight
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'
$runtimeType
has unbounded constraints.
\n
'
'
$runtimeType
has unbounded constraints.
\n
'
'This
$runtimeType
was given an aspect ratio of
$aspectRatio
but was given '
'This
$runtimeType
was given an aspect ratio of
$aspectRatio
but was given '
'both unbounded width and unbounded height constraints. Because both '
'both unbounded width and unbounded height constraints. Because both '
...
@@ -1386,7 +1386,7 @@ class RenderCustomPaint extends RenderProxyBox {
...
@@ -1386,7 +1386,7 @@ class RenderCustomPaint extends RenderProxyBox {
// below that number.
// below that number.
int
debugNewCanvasSaveCount
=
canvas
.
getSaveCount
();
int
debugNewCanvasSaveCount
=
canvas
.
getSaveCount
();
if
(
debugNewCanvasSaveCount
>
debugPreviousCanvasSaveCount
)
{
if
(
debugNewCanvasSaveCount
>
debugPreviousCanvasSaveCount
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$painter
custom painter called canvas.save() or canvas.saveLayer() at least '
'The
$painter
custom painter called canvas.save() or canvas.saveLayer() at least '
'
${debugNewCanvasSaveCount - debugPreviousCanvasSaveCount}
more '
'
${debugNewCanvasSaveCount - debugPreviousCanvasSaveCount}
more '
'time
${debugNewCanvasSaveCount - debugPreviousCanvasSaveCount == 1 ? '' : 's' }
'
'time
${debugNewCanvasSaveCount - debugPreviousCanvasSaveCount == 1 ? '' : 's' }
'
...
@@ -1396,7 +1396,7 @@ class RenderCustomPaint extends RenderProxyBox {
...
@@ -1396,7 +1396,7 @@ class RenderCustomPaint extends RenderProxyBox {
);
);
}
}
if
(
debugNewCanvasSaveCount
<
debugPreviousCanvasSaveCount
)
{
if
(
debugNewCanvasSaveCount
<
debugPreviousCanvasSaveCount
)
{
throw
new
Rendering
Error
(
throw
new
Flutter
Error
(
'The
$painter
custom painter called canvas.restore() '
'The
$painter
custom painter called canvas.restore() '
'
${debugPreviousCanvasSaveCount - debugNewCanvasSaveCount}
more '
'
${debugPreviousCanvasSaveCount - debugNewCanvasSaveCount}
more '
'time
${debugPreviousCanvasSaveCount - debugNewCanvasSaveCount == 1 ? '' : 's' }
'
'time
${debugPreviousCanvasSaveCount - debugNewCanvasSaveCount == 1 ? '' : 's' }
'
...
...
packages/flutter/lib/src/services/assertions.dart
View file @
7e3bef11
...
@@ -2,9 +2,32 @@
...
@@ -2,9 +2,32 @@
// 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.
/// Error class used to report Flutter-specific assertion failures and
/// contract violations.
class
FlutterError
extends
AssertionError
{
class
FlutterError
extends
AssertionError
{
/// Creates a [FlutterError].
///
/// See [message] for details on the format that the message should
/// take.
///
/// Include as much detail as possible in the full error message,
/// including specifics about the state of the app that might be
/// relevant to debugging the error.
FlutterError
(
this
.
message
);
FlutterError
(
this
.
message
);
/// The message associated with this error.
///
/// The message may have newlines in it. The first line should be a
/// terse description of the error, e.g. "Incorrect GlobalKey usage"
/// or "setState() or markNeedsBuild() called during build".
/// Subsequent lines can then contain more information. In some
/// cases, when a FlutterError is reported to the user, only the
/// first line is included. For example, Flutter will typically only
/// fully report the first exception at runtime, displaying only the
/// first line of subsequent errors.
///
/// All sentences in the error should be correctly punctuated (i.e.,
/// do end the error message with a period).
final
String
message
;
final
String
message
;
@override
@override
...
...
packages/flutter/lib/src/widgets/dismissable.dart
View file @
7e3bef11
...
@@ -291,7 +291,7 @@ class _DismissableState extends State<Dismissable> {
...
@@ -291,7 +291,7 @@ class _DismissableState extends State<Dismissable> {
assert
(()
{
assert
(()
{
if
(
_resizeAnimation
.
status
!=
AnimationStatus
.
forward
)
{
if
(
_resizeAnimation
.
status
!=
AnimationStatus
.
forward
)
{
assert
(
_resizeAnimation
.
status
==
AnimationStatus
.
completed
);
assert
(
_resizeAnimation
.
status
==
AnimationStatus
.
completed
);
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'A dismissed Dismissable widget is still part of the tree.
\n
'
+
'A dismissed Dismissable widget is still part of the tree.
\n
'
+
'Make sure to implement the onDismissed handler and to immediately remove the Dismissable
\n
'
+
'Make sure to implement the onDismissed handler and to immediately remove the Dismissable
\n
'
+
'widget from the application once that handler has fired.'
'widget from the application once that handler has fired.'
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
7e3bef11
...
@@ -9,6 +9,7 @@ import 'package:flutter/rendering.dart';
...
@@ -9,6 +9,7 @@ import 'package:flutter/rendering.dart';
export
'dart:ui'
show
hashValues
,
hashList
;
export
'dart:ui'
show
hashValues
,
hashList
;
export
'package:flutter/rendering.dart'
show
RenderObject
,
RenderBox
,
debugPrint
;
export
'package:flutter/rendering.dart'
show
RenderObject
,
RenderBox
,
debugPrint
;
export
'package:flutter/services.dart'
show
FlutterError
;
// KEYS
// KEYS
...
@@ -178,7 +179,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
...
@@ -178,7 +179,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
message
+=
'The most recently registered instance is:
${_registry[key]}
\n
'
;
message
+=
'The most recently registered instance is:
${_registry[key]}
\n
'
;
}
}
if
(
_debugDuplicates
.
isNotEmpty
)
{
if
(
_debugDuplicates
.
isNotEmpty
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Incorrect GlobalKey usage.
\n
'
'Incorrect GlobalKey usage.
\n
'
'
$message
'
'
$message
'
);
);
...
@@ -380,7 +381,7 @@ abstract class State<T extends StatefulWidget> {
...
@@ -380,7 +381,7 @@ abstract class State<T extends StatefulWidget> {
void
setState
(
VoidCallback
fn
)
{
void
setState
(
VoidCallback
fn
)
{
assert
(()
{
assert
(()
{
if
(
_debugLifecycleState
==
_StateLifecycle
.
defunct
)
{
if
(
_debugLifecycleState
==
_StateLifecycle
.
defunct
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'setState() called after dipose():
$this
\n
'
'setState() called after dipose():
$this
\n
'
'This error happens if you call setState() on State object for a widget that
\n
'
'This error happens if you call setState() on State object for a widget that
\n
'
'no longer appears in the widget tree (e.g., whose parent widget no longer
\n
'
'no longer appears in the widget tree (e.g., whose parent widget no longer
\n
'
...
@@ -1197,7 +1198,7 @@ abstract class BuildableElement extends Element {
...
@@ -1197,7 +1198,7 @@ abstract class BuildableElement extends Element {
return
true
;
return
true
;
}
}
if
(
_debugStateLocked
&&
(!
_debugAllowIgnoredCallsToMarkNeedsBuild
||
!
dirty
))
{
if
(
_debugStateLocked
&&
(!
_debugAllowIgnoredCallsToMarkNeedsBuild
||
!
dirty
))
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'setState() or markNeedsBuild() called during build.
\n
'
'setState() or markNeedsBuild() called during build.
\n
'
'This widget cannot be marked as needing to build because the framework '
'This widget cannot be marked as needing to build because the framework '
'is already in the process of building widgets. A widget can be marked as '
'is already in the process of building widgets. A widget can be marked as '
...
@@ -1296,7 +1297,7 @@ abstract class ComponentElement extends BuildableElement {
...
@@ -1296,7 +1297,7 @@ abstract class ComponentElement extends BuildableElement {
built
=
_builder
(
this
);
built
=
_builder
(
this
);
assert
(()
{
assert
(()
{
if
(
built
==
null
)
{
if
(
built
==
null
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'A build function returned null.
\n
'
'A build function returned null.
\n
'
'The offending widget is:
$widget
\n
'
'The offending widget is:
$widget
\n
'
'Build functions must never return null. '
'Build functions must never return null. '
...
@@ -1388,7 +1389,7 @@ class StatefulElement extends ComponentElement {
...
@@ -1388,7 +1389,7 @@ class StatefulElement extends ComponentElement {
assert
(()
{
assert
(()
{
if
(
_state
.
_debugLifecycleState
==
_StateLifecycle
.
initialized
)
if
(
_state
.
_debugLifecycleState
==
_StateLifecycle
.
initialized
)
return
true
;
return
true
;
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'
${_state.runtimeType}
.initState failed to call super.initState.
\n
'
'
${_state.runtimeType}
.initState failed to call super.initState.
\n
'
'initState() implementations must always call their superclass initState() method, to ensure '
'initState() implementations must always call their superclass initState() method, to ensure '
'that the entire widget is initialized correctly.'
'that the entire widget is initialized correctly.'
...
@@ -1430,7 +1431,7 @@ class StatefulElement extends ComponentElement {
...
@@ -1430,7 +1431,7 @@ class StatefulElement extends ComponentElement {
assert
(()
{
assert
(()
{
if
(
_state
.
_debugLifecycleState
==
_StateLifecycle
.
defunct
)
if
(
_state
.
_debugLifecycleState
==
_StateLifecycle
.
defunct
)
return
true
;
return
true
;
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'
${_state.runtimeType}
.dispose failed to call super.dispose.
\n
'
'
${_state.runtimeType}
.dispose failed to call super.dispose.
\n
'
'dispose() implementations must always call their superclass dispose() method, to ensure '
'dispose() implementations must always call their superclass dispose() method, to ensure '
'that all the resources used by the widget are fully released.'
'that all the resources used by the widget are fully released.'
...
@@ -1503,7 +1504,7 @@ class ParentDataElement<T extends RenderObjectWidget> extends _ProxyElement {
...
@@ -1503,7 +1504,7 @@ class ParentDataElement<T extends RenderObjectWidget> extends _ProxyElement {
}
}
if
(
ancestor
!=
null
&&
badAncestors
.
isEmpty
)
if
(
ancestor
!=
null
&&
badAncestors
.
isEmpty
)
return
true
;
return
true
;
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Incorrect use of ParentDataWidget.
\n
'
+
'Incorrect use of ParentDataWidget.
\n
'
+
widget
.
debugDescribeInvalidAncestorChain
(
widget
.
debugDescribeInvalidAncestorChain
(
description:
"
$this
"
,
description:
"
$this
"
,
...
@@ -1975,7 +1976,7 @@ class MultiChildRenderObjectElement extends RenderObjectElement {
...
@@ -1975,7 +1976,7 @@ class MultiChildRenderObjectElement extends RenderObjectElement {
continue
;
// when these nodes are reordered, we just reassign the data
continue
;
// when these nodes are reordered, we just reassign the data
if
(!
idSet
.
add
(
child
.
key
))
{
if
(!
idSet
.
add
(
child
.
key
))
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Duplicate keys found.
\n
'
'Duplicate keys found.
\n
'
'If multiple keyed nodes exist as children of another node, they must have unique keys.
\n
'
'If multiple keyed nodes exist as children of another node, they must have unique keys.
\n
'
'
$widget
has multiple children with key "
${child.key}
".'
'
$widget
has multiple children with key "
${child.key}
".'
...
@@ -2021,14 +2022,6 @@ class MultiChildRenderObjectElement extends RenderObjectElement {
...
@@ -2021,14 +2022,6 @@ class MultiChildRenderObjectElement extends RenderObjectElement {
}
}
}
}
class
WidgetError
extends
AssertionError
{
WidgetError
(
this
.
message
);
final
String
message
;
@override
String
toString
()
=>
message
;
}
typedef
void
WidgetsExceptionHandler
(
String
context
,
dynamic
exception
,
StackTrace
stack
);
typedef
void
WidgetsExceptionHandler
(
String
context
,
dynamic
exception
,
StackTrace
stack
);
/// This callback is invoked whenever an exception is caught by the widget
/// This callback is invoked whenever an exception is caught by the widget
/// system. The 'context' argument is a description of what was happening when
/// system. The 'context' argument is a description of what was happening when
...
...
packages/flutter/lib/src/widgets/gesture_detector.dart
View file @
7e3bef11
...
@@ -79,14 +79,14 @@ class GestureDetector extends StatelessWidget {
...
@@ -79,14 +79,14 @@ class GestureDetector extends StatelessWidget {
bool
haveScale
=
onScaleStart
!=
null
||
onScaleUpdate
!=
null
||
onScaleEnd
!=
null
;
bool
haveScale
=
onScaleStart
!=
null
||
onScaleUpdate
!=
null
||
onScaleEnd
!=
null
;
if
(
havePan
||
haveScale
)
{
if
(
havePan
||
haveScale
)
{
if
(
havePan
&&
haveScale
)
{
if
(
havePan
&&
haveScale
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Incorrect GestureDetector arguments.
\n
'
'Incorrect GestureDetector arguments.
\n
'
'Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan. Just use the scale gesture recognizer.'
'Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan. Just use the scale gesture recognizer.'
);
);
}
}
String
recognizer
=
havePan
?
'pan'
:
'scale'
;
String
recognizer
=
havePan
?
'pan'
:
'scale'
;
if
(
haveVerticalDrag
&&
haveHorizontalDrag
)
{
if
(
haveVerticalDrag
&&
haveHorizontalDrag
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Incorrect GestureDetector arguments.
\n
'
'Incorrect GestureDetector arguments.
\n
'
'Simultaneously having a vertical drag gesture recognizer, a horizontal drag gesture recognizer, and a
$recognizer
gesture recognizer '
'Simultaneously having a vertical drag gesture recognizer, a horizontal drag gesture recognizer, and a
$recognizer
gesture recognizer '
'will result in the
$recognizer
gesture recognizer being ignored, since the other two will catch all drags.'
'will result in the
$recognizer
gesture recognizer being ignored, since the other two will catch all drags.'
...
@@ -336,7 +336,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
...
@@ -336,7 +336,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
void
replaceGestureRecognizers
(
Map
<
Type
,
GestureRecognizerFactory
>
gestures
)
{
void
replaceGestureRecognizers
(
Map
<
Type
,
GestureRecognizerFactory
>
gestures
)
{
assert
(()
{
assert
(()
{
if
(!
RenderObject
.
debugDoingLayout
)
{
if
(!
RenderObject
.
debugDoingLayout
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Unexpected call to replaceGestureRecognizers() method of RawGestureDetectorState.
\n
'
'Unexpected call to replaceGestureRecognizers() method of RawGestureDetectorState.
\n
'
'The replaceGestureRecognizers() method can only be called during the layout phase. '
'The replaceGestureRecognizers() method can only be called during the layout phase. '
'To set the gesture recognisers at other times, trigger a new build using setState() '
'To set the gesture recognisers at other times, trigger a new build using setState() '
...
...
packages/flutter/lib/src/widgets/heroes.dart
View file @
7e3bef11
...
@@ -115,7 +115,7 @@ class Hero extends StatefulWidget {
...
@@ -115,7 +115,7 @@ class Hero extends StatefulWidget {
final
Map
<
Key
,
HeroState
>
tagHeroes
=
heroes
.
putIfAbsent
(
tag
,
()
=>
<
Key
,
HeroState
>{});
final
Map
<
Key
,
HeroState
>
tagHeroes
=
heroes
.
putIfAbsent
(
tag
,
()
=>
<
Key
,
HeroState
>{});
assert
(()
{
assert
(()
{
if
(
tagHeroes
.
containsKey
(
key
))
{
if
(
tagHeroes
.
containsKey
(
key
))
{
new
Widget
Error
(
new
Flutter
Error
(
'There are multiple heroes that share the same key within the same subtree.
\n
'
'There are multiple heroes that share the same key within the same subtree.
\n
'
'Within each subtree for which heroes are to be animated (typically a PageRoute subtree), '
'Within each subtree for which heroes are to be animated (typically a PageRoute subtree), '
'either each Hero must have a unique tag, or, all the heroes with a particular tag must '
'either each Hero must have a unique tag, or, all the heroes with a particular tag must '
...
...
packages/flutter/lib/src/widgets/mimic.dart
View file @
7e3bef11
...
@@ -181,7 +181,7 @@ class MimicableState extends State<Mimicable> {
...
@@ -181,7 +181,7 @@ class MimicableState extends State<Mimicable> {
MimicableHandle
startMimic
()
{
MimicableHandle
startMimic
()
{
assert
(()
{
assert
(()
{
if
(
_placeholderSize
!=
null
)
{
if
(
_placeholderSize
!=
null
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'Mimicable started while already active.
\n
'
'Mimicable started while already active.
\n
'
'When startMimic() or liftToOverlay() is called on a MimicableState, the mimic becomes active. '
'When startMimic() or liftToOverlay() is called on a MimicableState, the mimic becomes active. '
'While active, it cannot be reactivated until it is stopped. '
'While active, it cannot be reactivated until it is stopped. '
...
...
packages/flutter/lib/src/widgets/navigator.dart
View file @
7e3bef11
...
@@ -262,7 +262,7 @@ class Navigator extends StatefulWidget {
...
@@ -262,7 +262,7 @@ class Navigator extends StatefulWidget {
NavigatorState
navigator
=
context
.
ancestorStateOfType
(
const
TypeMatcher
<
NavigatorState
>());
NavigatorState
navigator
=
context
.
ancestorStateOfType
(
const
TypeMatcher
<
NavigatorState
>());
assert
(()
{
assert
(()
{
if
(
navigator
==
null
)
{
if
(
navigator
==
null
)
{
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'openTransaction called with a context that does not include a Navigator.
\n
'
'openTransaction called with a context that does not include a Navigator.
\n
'
'The context passed to the Navigator.openTransaction() method must be that of a widget that is a descendant of a Navigator widget.'
'The context passed to the Navigator.openTransaction() method must be that of a widget that is a descendant of a Navigator widget.'
);
);
...
...
packages/flutter/lib/src/widgets/overlay.dart
View file @
7e3bef11
...
@@ -90,7 +90,7 @@ class Overlay extends StatefulWidget {
...
@@ -90,7 +90,7 @@ class Overlay extends StatefulWidget {
String
additional
=
context
.
widget
!=
debugRequiredFor
String
additional
=
context
.
widget
!=
debugRequiredFor
?
'
\n
The context from which that widget was searching for an overlay was:
\n
$context
'
?
'
\n
The context from which that widget was searching for an overlay was:
\n
$context
'
:
''
;
:
''
;
throw
new
Widget
Error
(
throw
new
Flutter
Error
(
'No Overlay widget found.
\n
'
'No Overlay widget found.
\n
'
'
${debugRequiredFor.runtimeType}
widgets require an Overlay widget ancestor for correct operation.
\n
'
'
${debugRequiredFor.runtimeType}
widgets require an Overlay widget ancestor for correct operation.
\n
'
'The most common way to add an Overlay to an application is to include a MaterialApp or Navigator widget in the runApp() call.
\n
'
'The most common way to add an Overlay to an application is to include a MaterialApp or Navigator widget in the runApp() call.
\n
'
...
...
packages/flutter/test/widget/navigator_test.dart
View file @
7e3bef11
...
@@ -113,7 +113,7 @@ void main() {
...
@@ -113,7 +113,7 @@ void main() {
);
);
tester
.
pumpWidget
(
widget
);
tester
.
pumpWidget
(
widget
);
tester
.
tap
(
tester
.
findElementByKey
(
targetKey
));
tester
.
tap
(
tester
.
findElementByKey
(
targetKey
));
expect
(
exception
,
new
isInstanceOf
<
Widget
Error
>());
expect
(
exception
,
new
isInstanceOf
<
Flutter
Error
>());
expect
(
'
$exception
'
,
startsWith
(
'openTransaction called with a context'
));
expect
(
'
$exception
'
,
startsWith
(
'openTransaction called with a context'
));
});
});
});
});
...
...
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