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
55b6f049
Unverified
Commit
55b6f049
authored
Jul 06, 2023
by
Michael Goderbauer
Committed by
GitHub
Jul 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable unreachable_from_main lint - it is stable now!!1 (#129854)
PLUS: clean-up of all the unreachable stuff.
parent
99cb18b1
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
66 additions
and
419 deletions
+66
-419
analysis_options.yaml
analysis_options.yaml
+1
-1
compute_bench.dart
...enchmarks/microbenchmarks/lib/language/compute_bench.dart
+3
-2
main.dart
dev/benchmarks/platform_views_layout/lib/main.dart
+0
-7
main_non_intersecting.dart
...arks/platform_views_layout/lib/main_non_intersecting.dart
+0
-7
main.dart
...ks/platform_views_layout_hybrid_composition/lib/main.dart
+0
-7
url_strategy_integration.dart
...s/web_e2e_tests/test_driver/url_strategy_integration.dart
+0
-17
actions.dart
dev/manual_tests/lib/actions.dart
+3
-33
density.dart
dev/manual_tests/lib/density.dart
+2
-10
menu_anchor.dart
dev/manual_tests/lib/menu_anchor.dart
+0
-5
examples_smoke_test.dart
dev/tools/examples_smoke_test.dart
+1
-2
analysis_options.yaml
examples/api/analysis_options.yaml
+2
-0
isolates_test.dart
packages/flutter/test/foundation/isolates_test.dart
+1
-0
menu_anchor_test.dart
packages/flutter/test/material/menu_anchor_test.dart
+0
-5
image_stream_test.dart
packages/flutter/test/painting/image_stream_test.dart
+0
-2
semantics_update_test.dart
packages/flutter/test/semantics/semantics_update_test.dart
+0
-72
asset_manifest_test.dart
packages/flutter/test/services/asset_manifest_test.dart
+0
-28
async_lifecycle_test.dart
packages/flutter/test/widgets/async_lifecycle_test.dart
+6
-6
automatic_keep_alive_test.dart
packages/flutter/test/widgets/automatic_keep_alive_test.dart
+1
-25
fade_in_image_test.dart
packages/flutter/test/widgets/fade_in_image_test.dart
+0
-10
mark_needs_build_test.dart
packages/flutter/test/widgets/mark_needs_build_test.dart
+1
-1
render_object_element_test.dart
...ages/flutter/test/widgets/render_object_element_test.dart
+12
-12
reparent_state_harder_test.dart
...ages/flutter/test/widgets/reparent_state_harder_test.dart
+0
-2
router_test.dart
packages/flutter/test/widgets/router_test.dart
+0
-8
selectable_region_context_menu_test.dart
...ter/test/widgets/selectable_region_context_menu_test.dart
+1
-12
selectable_region_test.dart
packages/flutter/test/widgets/selectable_region_test.dart
+1
-11
semantics_10_test.dart
packages/flutter/test/widgets/semantics_10_test.dart
+3
-3
semantics_child_configs_delegate_test.dart
...r/test/widgets/semantics_child_configs_delegate_test.dart
+1
-1
shortcuts_test.dart
packages/flutter/test/widgets/shortcuts_test.dart
+1
-9
slivers_keepalive_test.dart
packages/flutter/test/widgets/slivers_keepalive_test.dart
+9
-11
snapshot_widget_test.dart
packages/flutter/test/widgets/snapshot_widget_test.dart
+0
-4
test_private.dart
packages/flutter/test_private/bin/test_private.dart
+7
-1
window_test.dart
packages/flutter_test/test/window_test.dart
+0
-1
xcode_backend.dart
packages/flutter_tools/bin/xcode_backend.dart
+0
-5
attach_test.dart
...utter_tools/test/commands.shard/hermetic/attach_test.dart
+2
-14
create_usage_test.dart
...tools/test/commands.shard/hermetic/create_usage_test.dart
+1
-3
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+0
-35
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+1
-3
android_project_migration_test.dart
...general.shard/android/android_project_migration_test.dart
+0
-8
android_sdk_test.dart
...er_tools/test/general.shard/android/android_sdk_test.dart
+0
-12
artifact_updater_test.dart
...utter_tools/test/general.shard/artifact_updater_test.dart
+2
-5
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+2
-3
terminal_handler_test.dart
...utter_tools/test/general.shard/terminal_handler_test.dart
+0
-1
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+1
-3
devices_test.dart
...es/flutter_tools/test/general.shard/web/devices_test.dart
+1
-7
xcode_backend_test.dart
.../flutter_tools/test/general.shard/xcode_backend_test.dart
+0
-5
No files found.
analysis_options.yaml
View file @
55b6f049
...
...
@@ -223,7 +223,7 @@ linter:
-
unnecessary_string_interpolations
-
unnecessary_this
-
unnecessary_to_list_in_spreads
# - unreachable_from_main # Do not enable this rule until it is un-marked as "experimental" and carefully re-evaluated.
-
unreachable_from_main
-
unrelated_type_equality_checks
-
unsafe_html
-
use_build_context_synchronously
...
...
dev/benchmarks/microbenchmarks/lib/language/compute_bench.dart
View file @
55b6f049
...
...
@@ -12,9 +12,10 @@ const int _kNumWarmUp = 100;
class
Data
{
Data
(
this
.
value
);
Map
<
String
,
dynamic
>
toJson
()
=>
<
String
,
dynamic
>{
'value'
:
value
};
final
int
value
;
@override
String
toString
()
=>
'Data(
$value
)'
;
}
List
<
Data
>
test
(
int
length
)
{
...
...
dev/benchmarks/platform_views_layout/lib/main.dart
View file @
55b6f049
...
...
@@ -5,7 +5,6 @@
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
show
timeDilation
;
void
main
(
)
{
runApp
(
...
...
@@ -31,12 +30,6 @@ class PlatformViewAppState extends State<PlatformViewApp> {
home:
const
PlatformViewLayout
(),
);
}
void
toggleAnimationSpeed
()
{
setState
(()
{
timeDilation
=
(
timeDilation
!=
1.0
)
?
1.0
:
5.0
;
});
}
}
class
PlatformViewLayout
extends
StatelessWidget
{
...
...
dev/benchmarks/platform_views_layout/lib/main_non_intersecting.dart
View file @
55b6f049
...
...
@@ -5,7 +5,6 @@
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
show
timeDilation
;
void
main
(
)
{
runApp
(
...
...
@@ -31,12 +30,6 @@ class PlatformViewAppState extends State<PlatformViewApp> {
home:
const
PlatformViewLayout
(),
);
}
void
toggleAnimationSpeed
()
{
setState
(()
{
timeDilation
=
(
timeDilation
!=
1.0
)
?
1.0
:
5.0
;
});
}
}
class
PlatformViewLayout
extends
StatelessWidget
{
...
...
dev/benchmarks/platform_views_layout_hybrid_composition/lib/main.dart
View file @
55b6f049
...
...
@@ -5,7 +5,6 @@
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
show
timeDilation
;
import
'package:flutter_driver/driver_extension.dart'
;
import
'android_platform_view.dart'
;
...
...
@@ -35,12 +34,6 @@ class PlatformViewAppState extends State<PlatformViewApp> {
home:
const
PlatformViewLayout
(),
);
}
void
toggleAnimationSpeed
()
{
setState
(()
{
timeDilation
=
(
timeDilation
!=
1.0
)
?
1.0
:
5.0
;
});
}
}
class
PlatformViewLayout
extends
StatelessWidget
{
...
...
dev/integration_tests/web_e2e_tests/test_driver/url_strategy_integration.dart
View file @
55b6f049
...
...
@@ -46,11 +46,6 @@ void main() {
/// It keeps a list of history entries and event listeners in memory and
/// manipulates them in order to achieve the desired functionality.
class
TestUrlStrategy
extends
UrlStrategy
{
/// Creates a instance of [TestUrlStrategy] with an empty string as the
/// path.
factory
TestUrlStrategy
()
=>
TestUrlStrategy
.
fromEntry
(
const
TestHistoryEntry
(
null
,
null
,
''
));
/// Creates an instance of [TestUrlStrategy] and populates it with a list
/// that has [initialEntry] as the only item.
TestUrlStrategy
.
fromEntry
(
TestHistoryEntry
initialEntry
)
...
...
@@ -64,8 +59,6 @@ class TestUrlStrategy extends UrlStrategy {
dynamic
getState
()
=>
currentEntry
.
state
;
int
_currentEntryIndex
;
int
get
currentEntryIndex
=>
_currentEntryIndex
;
final
List
<
TestHistoryEntry
>
history
;
TestHistoryEntry
get
currentEntry
{
...
...
@@ -105,16 +98,6 @@ class TestUrlStrategy extends UrlStrategy {
currentEntry
=
TestHistoryEntry
(
state
,
title
,
url
);
}
/// This simulates the case where a user types in a url manually. It causes
/// a new state to be pushed, and all event listeners will be invoked.
Future
<
void
>
simulateUserTypingUrl
(
String
url
)
{
assert
(
withinAppHistory
);
return
_nextEventLoop
(()
{
pushState
(
null
,
''
,
url
);
_firePopStateEvent
();
});
}
@override
Future
<
void
>
go
(
int
count
)
{
assert
(
withinAppHistory
);
...
...
dev/manual_tests/lib/actions.dart
View file @
55b6f049
...
...
@@ -56,13 +56,6 @@ class Memento extends Object with Diagnosticable {
/// An [ActionDispatcher] subclass that manages the invocation of undoable
/// actions.
class
UndoableActionDispatcher
extends
ActionDispatcher
implements
Listenable
{
/// Constructs a new [UndoableActionDispatcher].
///
/// The [maxUndoLevels] argument must not be null.
UndoableActionDispatcher
({
int
maxUndoLevels
=
_defaultMaxUndoLevels
,
})
:
_maxUndoLevels
=
maxUndoLevels
;
// A stack of actions that have been performed. The most recent action
// performed is at the end of the list.
final
DoubleLinkedQueue
<
Memento
>
_completedActions
=
DoubleLinkedQueue
<
Memento
>();
...
...
@@ -70,19 +63,12 @@ class UndoableActionDispatcher extends ActionDispatcher implements Listenable {
// at the end of the list.
final
List
<
Memento
>
_undoneActions
=
<
Memento
>[];
static
const
int
_defaultMaxUndoLevels
=
1000
;
/// The maximum number of undo levels allowed.
///
/// If this value is set to a value smaller than the number of completed
/// actions, then the stack of completed actions is truncated to only include
/// the last [maxUndoLevels] actions.
int
get
maxUndoLevels
=>
_maxUndoLevels
;
int
_maxUndoLevels
;
set
maxUndoLevels
(
int
value
)
{
_maxUndoLevels
=
value
;
_pruneActions
();
}
int
get
maxUndoLevels
=>
1000
;
final
Set
<
VoidCallback
>
_listeners
=
<
VoidCallback
>{};
...
...
@@ -121,7 +107,7 @@ class UndoableActionDispatcher extends ActionDispatcher implements Listenable {
// Enforces undo level limit.
void
_pruneActions
()
{
while
(
_completedActions
.
length
>
_
maxUndoLevels
)
{
while
(
_completedActions
.
length
>
maxUndoLevels
)
{
_completedActions
.
removeFirst
();
}
}
...
...
@@ -237,26 +223,12 @@ class RedoAction extends Action<RedoIntent> {
}
/// An action that can be undone.
abstract
class
UndoableAction
<
T
extends
Intent
>
extends
Action
<
T
>
{
/// The [Intent] this action was originally invoked with.
Intent
?
get
invocationIntent
=>
_invocationTag
;
Intent
?
_invocationTag
;
@protected
set
invocationIntent
(
Intent
?
value
)
=>
_invocationTag
=
value
;
@override
@mustCallSuper
void
invoke
(
T
intent
)
{
invocationIntent
=
intent
;
}
}
abstract
class
UndoableAction
<
T
extends
Intent
>
extends
Action
<
T
>
{
}
class
UndoableFocusActionBase
<
T
extends
Intent
>
extends
UndoableAction
<
T
>
{
@override
@mustCallSuper
Memento
invoke
(
T
intent
)
{
super
.
invoke
(
intent
);
final
FocusNode
?
previousFocus
=
primaryFocus
;
return
Memento
(
name:
previousFocus
!.
debugLabel
!,
undo:
()
{
previousFocus
.
requestFocus
();
...
...
@@ -295,8 +267,6 @@ class UndoablePreviousFocusAction extends UndoableFocusActionBase<PreviousFocusI
}
class
UndoableDirectionalFocusAction
extends
UndoableFocusActionBase
<
DirectionalFocusIntent
>
{
TraversalDirection
?
direction
;
@override
Memento
invoke
(
DirectionalFocusIntent
intent
)
{
final
Memento
memento
=
super
.
invoke
(
intent
);
...
...
dev/manual_tests/lib/density.dart
View file @
55b6f049
...
...
@@ -30,15 +30,13 @@ class MyApp extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
const
MaterialApp
(
title:
_title
,
home:
MyHomePage
(
title:
_title
),
home:
MyHomePage
(),
);
}
}
class
MyHomePage
extends
StatefulWidget
{
const
MyHomePage
({
super
.
key
,
required
this
.
title
});
final
String
title
;
const
MyHomePage
({
super
.
key
});
@override
State
<
MyHomePage
>
createState
()
=>
_MyHomePageState
();
...
...
@@ -92,12 +90,6 @@ class OptionModel extends ChangeNotifier {
bool
get
longText
=>
_longText
;
bool
_longText
=
false
;
set
longText
(
bool
longText
)
{
if
(
longText
!=
_longText
)
{
_longText
=
longText
;
notifyListeners
();
}
}
void
reset
()
{
final
OptionModel
defaultModel
=
OptionModel
();
...
...
dev/manual_tests/lib/menu_anchor.dart
View file @
55b6f049
...
...
@@ -778,9 +778,4 @@ enum TestMenu {
final
String
acceleratorLabel
;
// Strip the accelerator markers.
String
get
label
=>
MenuAcceleratorLabel
.
stripAcceleratorMarkers
(
acceleratorLabel
);
int
get
acceleratorIndex
{
int
index
=
-
1
;
MenuAcceleratorLabel
.
stripAcceleratorMarkers
(
acceleratorLabel
,
setIndex:
(
int
i
)
=>
index
=
i
);
return
index
;
}
}
dev/tools/examples_smoke_test.dart
View file @
55b6f049
...
...
@@ -81,13 +81,12 @@ Future<void> runSmokeTests({
// A class to hold information related to an example, used to generate names
// from for the tests.
class
ExampleInfo
{
ExampleInfo
(
this
.
file
,
Directory
examplesLibDir
)
ExampleInfo
(
File
file
,
Directory
examplesLibDir
)
:
importPath
=
_getImportPath
(
file
,
examplesLibDir
),
importName
=
''
{
importName
=
importPath
.
replaceAll
(
RegExp
(
r'\.dart$'
),
''
).
replaceAll
(
RegExp
(
r'\W'
),
'_'
);
}
final
File
file
;
final
String
importPath
;
String
importName
;
...
...
examples/api/analysis_options.yaml
View file @
55b6f049
...
...
@@ -6,3 +6,5 @@ linter:
rules
:
# Samples want to print things pretty often.
avoid_print
:
false
# Samples are sometimes incomplete and don't show usage of everything.
unreachable_from_main
:
false
packages/flutter/test/foundation/isolates_test.dart
View file @
55b6f049
...
...
@@ -139,6 +139,7 @@ Future<int> computeInstanceMethod(int square) {
Future
<
int
>
computeInvalidInstanceMethod
(
int
square
)
{
final
ComputeTestSubject
subject
=
ComputeTestSubject
(
square
,
ReceivePort
());
expect
(
subject
.
additional
,
isA
<
ReceivePort
>());
return
compute
(
subject
.
method
,
square
);
}
...
...
packages/flutter/test/material/menu_anchor_test.dart
View file @
55b6f049
...
...
@@ -3256,9 +3256,4 @@ enum TestMenu {
final
String
acceleratorLabel
;
// Strip the accelerator markers.
String
get
label
=>
MenuAcceleratorLabel
.
stripAcceleratorMarkers
(
acceleratorLabel
);
int
get
acceleratorIndex
{
int
index
=
-
1
;
MenuAcceleratorLabel
.
stripAcceleratorMarkers
(
acceleratorLabel
,
setIndex:
(
int
i
)
=>
index
=
i
);
return
index
;
}
}
packages/flutter/test/painting/image_stream_test.dart
View file @
55b6f049
...
...
@@ -26,8 +26,6 @@ class FakeFrameInfo implements FrameInfo {
@override
Image
get
image
=>
_image
;
int
get
imageHandleCount
=>
image
.
debugGetOpenHandleStackTraces
()!.
length
;
FakeFrameInfo
clone
()
{
return
FakeFrameInfo
(
_duration
,
...
...
packages/flutter/test/semantics/semantics_update_test.dart
View file @
55b6f049
...
...
@@ -218,37 +218,13 @@ class SemanticsUpdateBuilderSpy extends Fake implements ui.SemanticsUpdateBuilde
// Makes sure we don't send the same id twice.
assert
(!
observations
.
containsKey
(
id
));
observations
[
id
]
=
SemanticsNodeUpdateObservation
(
id:
id
,
flags:
flags
,
actions:
actions
,
maxValueLength:
maxValueLength
,
currentValueLength:
currentValueLength
,
textSelectionBase:
textSelectionBase
,
textSelectionExtent:
textSelectionExtent
,
platformViewId:
platformViewId
,
scrollChildren:
scrollChildren
,
scrollIndex:
scrollIndex
,
scrollPosition:
scrollPosition
,
scrollExtentMax:
scrollExtentMax
,
scrollExtentMin:
scrollExtentMin
,
elevation:
elevation
,
thickness:
thickness
,
rect:
rect
,
label:
label
,
labelAttributes:
labelAttributes
,
hint:
hint
,
hintAttributes:
hintAttributes
,
value:
value
,
valueAttributes:
valueAttributes
,
increasedValue:
increasedValue
,
increasedValueAttributes:
increasedValueAttributes
,
decreasedValue:
decreasedValue
,
decreasedValueAttributes:
decreasedValueAttributes
,
textDirection:
textDirection
,
transform:
transform
,
childrenInTraversalOrder:
childrenInTraversalOrder
,
childrenInHitTestOrder:
childrenInHitTestOrder
,
additionalActions:
additionalActions
,
);
}
...
...
@@ -262,68 +238,20 @@ class SemanticsUpdateBuilderSpy extends Fake implements ui.SemanticsUpdateBuilde
class
SemanticsNodeUpdateObservation
{
const
SemanticsNodeUpdateObservation
({
required
this
.
id
,
required
this
.
flags
,
required
this
.
actions
,
required
this
.
maxValueLength
,
required
this
.
currentValueLength
,
required
this
.
textSelectionBase
,
required
this
.
textSelectionExtent
,
required
this
.
platformViewId
,
required
this
.
scrollChildren
,
required
this
.
scrollIndex
,
required
this
.
scrollPosition
,
required
this
.
scrollExtentMax
,
required
this
.
scrollExtentMin
,
required
this
.
elevation
,
required
this
.
thickness
,
required
this
.
rect
,
required
this
.
label
,
this
.
labelAttributes
,
required
this
.
value
,
this
.
valueAttributes
,
required
this
.
increasedValue
,
this
.
increasedValueAttributes
,
required
this
.
decreasedValue
,
this
.
decreasedValueAttributes
,
required
this
.
hint
,
this
.
hintAttributes
,
this
.
textDirection
,
required
this
.
transform
,
required
this
.
childrenInTraversalOrder
,
required
this
.
childrenInHitTestOrder
,
required
this
.
additionalActions
,
});
final
int
id
;
final
int
flags
;
final
int
actions
;
final
int
maxValueLength
;
final
int
currentValueLength
;
final
int
textSelectionBase
;
final
int
textSelectionExtent
;
final
int
platformViewId
;
final
int
scrollChildren
;
final
int
scrollIndex
;
final
double
scrollPosition
;
final
double
scrollExtentMax
;
final
double
scrollExtentMin
;
final
double
elevation
;
final
double
thickness
;
final
Rect
rect
;
final
String
label
;
final
List
<
StringAttribute
>?
labelAttributes
;
final
String
value
;
final
List
<
StringAttribute
>?
valueAttributes
;
final
String
increasedValue
;
final
List
<
StringAttribute
>?
increasedValueAttributes
;
final
String
decreasedValue
;
final
List
<
StringAttribute
>?
decreasedValueAttributes
;
final
String
hint
;
final
List
<
StringAttribute
>?
hintAttributes
;
final
TextDirection
?
textDirection
;
final
Float64List
transform
;
final
Int32List
childrenInTraversalOrder
;
final
Int32List
childrenInHitTestOrder
;
final
Int32List
additionalActions
;
}
packages/flutter/test/services/asset_manifest_test.dart
View file @
55b6f049
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:convert'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -73,29 +71,3 @@ void main() {
expect
(
manifest
.
getAssetVariants
(
'invalid asset key'
),
isNull
);
});
}
String
createAssetManifestJson
(
Map
<
String
,
List
<
AssetMetadata
>>
manifest
)
{
final
Map
<
Object
,
Object
>
jsonObject
=
manifest
.
map
(
(
String
key
,
List
<
AssetMetadata
>
value
)
{
final
List
<
String
>
variants
=
value
.
map
((
AssetMetadata
e
)
=>
e
.
key
).
toList
();
return
MapEntry
<
String
,
List
<
String
>>(
key
,
variants
);
}
);
return
json
.
encode
(
jsonObject
);
}
ByteData
createAssetManifestSmcBin
(
Map
<
String
,
List
<
AssetMetadata
>>
manifest
)
{
final
Map
<
Object
,
Object
>
smcObject
=
manifest
.
map
(
(
String
key
,
List
<
AssetMetadata
>
value
)
{
final
List
<
Object
>
variants
=
value
.
map
((
AssetMetadata
variant
)
=>
<
String
,
Object
?>{
'asset'
:
variant
.
key
,
'dpr'
:
variant
.
targetDevicePixelRatio
,
}).
toList
();
return
MapEntry
<
String
,
List
<
Object
>>(
key
,
variants
);
}
);
return
const
StandardMessageCodec
().
encodeMessage
(
smcObject
)!;
}
packages/flutter/test/widgets/async_lifecycle_test.dart
View file @
55b6f049
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/
widgets
.dart'
;
import
'package:flutter/
material
.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
class
InvalidOnInitLifecycleWidget
extends
StatefulWidget
{
...
...
@@ -25,9 +25,9 @@ class InvalidOnInitLifecycleWidgetState extends State<InvalidOnInitLifecycleWidg
}
class
InvalidDidUpdateWidgetLifecycleWidget
extends
StatefulWidget
{
const
InvalidDidUpdateWidgetLifecycleWidget
({
super
.
key
,
required
this
.
id
});
const
InvalidDidUpdateWidgetLifecycleWidget
({
super
.
key
,
required
this
.
color
});
final
int
id
;
final
Color
color
;
@override
InvalidDidUpdateWidgetLifecycleWidgetState
createState
()
=>
InvalidDidUpdateWidgetLifecycleWidgetState
();
...
...
@@ -41,7 +41,7 @@ class InvalidDidUpdateWidgetLifecycleWidgetState extends State<InvalidDidUpdateW
@override
Widget
build
(
BuildContext
context
)
{
return
Co
ntainer
(
);
return
Co
loredBox
(
color:
widget
.
color
);
}
}
...
...
@@ -53,8 +53,8 @@ void main() {
});
testWidgets
(
'async didUpdateWidget throws FlutterError'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
InvalidDidUpdateWidgetLifecycleWidget
(
id:
1
));
await
tester
.
pumpWidget
(
const
InvalidDidUpdateWidgetLifecycleWidget
(
id:
2
));
await
tester
.
pumpWidget
(
const
InvalidDidUpdateWidgetLifecycleWidget
(
color:
Colors
.
green
));
await
tester
.
pumpWidget
(
const
InvalidDidUpdateWidgetLifecycleWidget
(
color:
Colors
.
red
));
expect
(
tester
.
takeException
(),
isFlutterError
);
});
...
...
packages/flutter/test/widgets/automatic_keep_alive_test.dart
View file @
55b6f049
...
...
@@ -600,23 +600,7 @@ class _AlwaysKeepAliveState extends State<_AlwaysKeepAlive> with AutomaticKeepAl
}
}
class
RenderBoxKeepAlive
extends
RenderBox
{
State
<
StatefulWidget
>
createState
()
=>
AlwaysKeepAliveRenderBoxState
();
}
class
AlwaysKeepAliveRenderBoxState
extends
State
<
_AlwaysKeepAlive
>
with
AutomaticKeepAliveClientMixin
<
_AlwaysKeepAlive
>
{
@override
bool
get
wantKeepAlive
=>
true
;
@override
Widget
build
(
BuildContext
context
)
{
super
.
build
(
context
);
return
const
SizedBox
(
height:
48.0
,
child:
Text
(
'keep me alive'
),
);
}
}
class
RenderBoxKeepAlive
extends
RenderBox
{
}
mixin
KeepAliveParentDataMixinAlt
implements
KeepAliveParentDataMixin
{
@override
...
...
@@ -631,14 +615,6 @@ class RenderSliverMultiBoxAdaptorAlt extends RenderSliver with
RenderSliverHelpers
,
RenderSliverWithKeepAliveMixin
{
RenderSliverMultiBoxAdaptorAlt
({
RenderSliverBoxChildManager
?
childManager
,
})
:
_childManager
=
childManager
;
@protected
RenderSliverBoxChildManager
?
get
childManager
=>
_childManager
;
final
RenderSliverBoxChildManager
?
_childManager
;
final
List
<
RenderBox
>
children
=
<
RenderBox
>[];
void
insert
(
RenderBox
child
,
{
RenderBox
?
after
})
{
...
...
packages/flutter/test/widgets/fade_in_image_test.dart
View file @
55b6f049
...
...
@@ -30,16 +30,6 @@ class FadeInImageParts {
expect
(
animatedFadeOutFadeInElement
,
isNotNull
);
return
animatedFadeOutFadeInElement
!.
state
;
}
Element
?
get
semanticsElement
{
Element
?
result
;
fadeInImageElement
.
visitChildren
((
Element
child
)
{
if
(
child
.
widget
is
Semantics
)
{
result
=
child
;
}
});
return
result
;
}
}
class
FadeInImageElements
{
...
...
packages/flutter/test/widgets/mark_needs_build_test.dart
View file @
55b6f049
...
...
@@ -106,7 +106,7 @@ class _TestWidgetState extends State<TestWidget> {
calledDuringBuild
++;
});
return
SizedBox
.
expand
(
child:
Text
(
Directionality
.
of
(
context
).
toString
()
),
child:
Text
(
'
${widget.value}
:
${Directionality.of(context)}
'
),
);
}
}
packages/flutter/test/widgets/render_object_element_test.dart
View file @
55b6f049
...
...
@@ -137,8 +137,8 @@ class SwapperElementWithProperOverrides extends SwapperElement {
}
class
RenderSwapper
extends
RenderBox
{
RenderBox
?
_stable
;
RenderBox
?
get
stable
=>
_stable
;
RenderBox
?
_stable
;
set
stable
(
RenderBox
?
child
)
{
if
(
child
==
_stable
)
{
return
;
...
...
@@ -153,8 +153,8 @@ class RenderSwapper extends RenderBox {
}
bool
?
_swapperIsOnTop
;
RenderBox
?
_swapper
;
RenderBox
?
get
swapper
=>
_swapper
;
RenderBox
?
_swapper
;
void
setSwapper
(
RenderBox
?
child
,
bool
isOnTop
)
{
if
(
isOnTop
!=
_swapperIsOnTop
)
{
_swapperIsOnTop
=
isOnTop
;
...
...
@@ -174,11 +174,11 @@ class RenderSwapper extends RenderBox {
@override
void
visitChildren
(
RenderObjectVisitor
visitor
)
{
if
(
_
stable
!=
null
)
{
visitor
(
_
stable
!);
if
(
stable
!=
null
)
{
visitor
(
stable
!);
}
if
(
_
swapper
!=
null
)
{
visitor
(
_
swapper
!);
if
(
swapper
!=
null
)
{
visitor
(
swapper
!);
}
}
...
...
@@ -210,14 +210,14 @@ class RenderSwapper extends RenderBox {
minHeight:
constraints
.
minHeight
/
2
,
maxHeight:
constraints
.
maxHeight
/
2
,
);
if
(
_
stable
!=
null
)
{
final
BoxParentData
stableParentData
=
_
stable
!.
parentData
!
as
BoxParentData
;
_
stable
!.
layout
(
childConstraints
);
if
(
stable
!=
null
)
{
final
BoxParentData
stableParentData
=
stable
!.
parentData
!
as
BoxParentData
;
stable
!.
layout
(
childConstraints
);
stableParentData
.
offset
=
_swapperIsOnTop
!
?
bottomOffset
:
topOffset
;
}
if
(
_
swapper
!=
null
)
{
final
BoxParentData
swapperParentData
=
_
swapper
!.
parentData
!
as
BoxParentData
;
_
swapper
!.
layout
(
childConstraints
);
if
(
swapper
!=
null
)
{
final
BoxParentData
swapperParentData
=
swapper
!.
parentData
!
as
BoxParentData
;
swapper
!.
layout
(
childConstraints
);
swapperParentData
.
offset
=
_swapperIsOnTop
!
?
topOffset
:
bottomOffset
;
}
}
...
...
packages/flutter/test/widgets/reparent_state_harder_test.dart
View file @
55b6f049
...
...
@@ -63,10 +63,8 @@ class DummyStatefulWidgetState extends State<DummyStatefulWidget> {
class
RekeyableDummyStatefulWidgetWrapper
extends
StatefulWidget
{
const
RekeyableDummyStatefulWidgetWrapper
({
super
.
key
,
this
.
child
,
required
this
.
initialKey
,
});
final
Widget
?
child
;
final
GlobalKey
initialKey
;
@override
RekeyableDummyStatefulWidgetWrapperState
createState
()
=>
RekeyableDummyStatefulWidgetWrapperState
();
...
...
packages/flutter/test/widgets/router_test.dart
View file @
55b6f049
...
...
@@ -1610,10 +1610,6 @@ class SimpleNavigatorRouterDelegate extends RouterDelegate<RouteInformation> wit
RouteInformation
get
routeInformation
=>
_routeInformation
;
late
RouteInformation
_routeInformation
;
set
routeInformation
(
RouteInformation
newValue
)
{
_routeInformation
=
newValue
;
notifyListeners
();
}
SimpleRouterDelegateBuilder
builder
;
SimpleNavigatorRouterDelegatePopPage
<
void
>
onPopPage
;
...
...
@@ -1711,10 +1707,6 @@ class SimpleAsyncRouterDelegate extends RouterDelegate<RouteInformation> with Ch
RouteInformation
?
get
routeInformation
=>
_routeInformation
;
RouteInformation
?
_routeInformation
;
set
routeInformation
(
RouteInformation
?
newValue
)
{
_routeInformation
=
newValue
;
notifyListeners
();
}
SimpleRouterDelegateBuilder
builder
;
late
Future
<
void
>
setNewRouteFuture
;
...
...
packages/flutter/test/widgets/selectable_region_context_menu_test.dart
View file @
55b6f049
...
...
@@ -18,7 +18,6 @@ extension on web.CSSRuleList {
Iterable
<
web
.
CSSRule
>
get
iterable
=>
_genIterable
(
this
);
}
typedef
ItemGetter
<
T
>
=
T
?
Function
(
int
index
);
Iterable
<
T
>
_genIterable
<
T
>(
dynamic
jsCollection
)
{
// ignore: avoid_dynamic_calls
return
Iterable
<
T
>.
generate
(
jsCollection
.
length
as
int
,
(
int
index
)
=>
jsCollection
.
item
(
index
)
as
T
,);
...
...
@@ -159,8 +158,7 @@ class RenderSelectionSpy extends RenderProxyBox
}
@override
SelectionGeometry
get
value
=>
_value
;
SelectionGeometry
_value
=
const
SelectionGeometry
(
final
SelectionGeometry
value
=
const
SelectionGeometry
(
hasContent:
true
,
status:
SelectionStatus
.
uncollapsed
,
startSelectionPoint:
SelectionPoint
(
...
...
@@ -174,15 +172,6 @@ class RenderSelectionSpy extends RenderProxyBox
handleType:
TextSelectionHandleType
.
left
,
),
);
set
value
(
SelectionGeometry
other
)
{
if
(
other
==
_value
)
{
return
;
}
_value
=
other
;
for
(
final
VoidCallback
callback
in
listeners
)
{
callback
();
}
}
@override
void
pushHandleLayers
(
LayerLink
?
startHandle
,
LayerLink
?
endHandle
)
{
}
...
...
packages/flutter/test/widgets/selectable_region_test.dart
View file @
55b6f049
...
...
@@ -2526,8 +2526,7 @@ class RenderSelectionSpy extends RenderProxyBox
}
@override
SelectionGeometry
get
value
=>
_value
;
SelectionGeometry
_value
=
const
SelectionGeometry
(
final
SelectionGeometry
value
=
const
SelectionGeometry
(
hasContent:
true
,
status:
SelectionStatus
.
uncollapsed
,
startSelectionPoint:
SelectionPoint
(
...
...
@@ -2541,15 +2540,6 @@ class RenderSelectionSpy extends RenderProxyBox
handleType:
TextSelectionHandleType
.
left
,
),
);
set
value
(
SelectionGeometry
other
)
{
if
(
other
==
_value
)
{
return
;
}
_value
=
other
;
for
(
final
VoidCallback
callback
in
listeners
)
{
callback
();
}
}
@override
void
pushHandleLayers
(
LayerLink
?
startHandle
,
LayerLink
?
endHandle
)
{
}
...
...
packages/flutter/test/widgets/semantics_10_test.dart
View file @
55b6f049
...
...
@@ -96,13 +96,13 @@ class RenderTest extends RenderProxyBox {
void
describeSemanticsConfiguration
(
SemanticsConfiguration
config
)
{
super
.
describeSemanticsConfiguration
(
config
);
if
(!
_
isSemanticBoundary
)
{
if
(!
isSemanticBoundary
)
{
return
;
}
config
..
isSemanticBoundary
=
_
isSemanticBoundary
..
label
=
_
label
..
isSemanticBoundary
=
isSemanticBoundary
..
label
=
label
..
textDirection
=
TextDirection
.
ltr
;
}
...
...
packages/flutter/test/widgets/semantics_child_configs_delegate_test.dart
View file @
55b6f049
...
...
@@ -357,6 +357,6 @@ class RenderTestConfigDelegate extends RenderProxyBox {
@override
void
describeSemanticsConfiguration
(
SemanticsConfiguration
config
)
{
config
.
childConfigurationsDelegate
=
_
delegate
;
config
.
childConfigurationsDelegate
=
delegate
;
}
}
packages/flutter/test/widgets/shortcuts_test.dart
View file @
55b6f049
...
...
@@ -601,18 +601,12 @@ void main() {
testWidgets
(
'Shortcuts.manager lets manager handle shortcuts'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
containerKey
=
GlobalKey
();
final
List
<
LogicalKeyboardKey
>
pressedKeys
=
<
LogicalKeyboardKey
>[];
bool
shortcutsSet
=
false
;
void
onShortcutsSet
()
{
shortcutsSet
=
true
;
}
final
TestShortcutManager
testManager
=
TestShortcutManager
(
pressedKeys
,
onShortcutsSet:
onShortcutsSet
,
shortcuts:
<
LogicalKeySet
,
Intent
>{
LogicalKeySet
(
LogicalKeyboardKey
.
shift
):
const
TestIntent
(),
},
);
shortcutsSet
=
false
;
bool
invoked
=
false
;
await
tester
.
pumpWidget
(
Actions
(
...
...
@@ -636,7 +630,6 @@ void main() {
await
tester
.
pump
();
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
expect
(
invoked
,
isTrue
);
expect
(
shortcutsSet
,
isFalse
);
expect
(
pressedKeys
,
equals
(<
LogicalKeyboardKey
>[
LogicalKeyboardKey
.
shiftLeft
]));
});
...
...
@@ -1953,10 +1946,9 @@ class TestIntent2 extends Intent {
}
class
TestShortcutManager
extends
ShortcutManager
{
TestShortcutManager
(
this
.
keys
,
{
super
.
shortcuts
,
this
.
onShortcutsSet
});
TestShortcutManager
(
this
.
keys
,
{
super
.
shortcuts
});
List
<
LogicalKeyboardKey
>
keys
;
VoidCallback
?
onShortcutsSet
;
@override
KeyEventResult
handleKeypress
(
BuildContext
context
,
RawKeyEvent
event
)
{
...
...
packages/flutter/test/widgets/slivers_keepalive_test.dart
View file @
55b6f049
...
...
@@ -319,7 +319,7 @@ void main() {
WidgetTest2
(
text:
'child 2'
,
key:
UniqueKey
()),
];
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
final
_WidgetTest0State
state0
=
tester
.
state
(
find
.
byType
(
WidgetTest0
));
final
_WidgetTest1State
state1
=
tester
.
state
(
find
.
byType
(
WidgetTest1
));
...
...
@@ -330,32 +330,32 @@ void main() {
childList
=
createSwitchedChildList
(
childList
,
0
,
2
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
childList
=
createSwitchedChildList
(
childList
,
1
,
2
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
childList
=
createSwitchedChildList
(
childList
,
1
,
2
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
childList
=
createSwitchedChildList
(
childList
,
0
,
1
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
childList
=
createSwitchedChildList
(
childList
,
0
,
2
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
childList
=
createSwitchedChildList
(
childList
,
0
,
1
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
expect
(
state0
.
hasBeenDisposed
,
false
);
expect
(
state1
.
hasBeenDisposed
,
true
);
...
...
@@ -369,7 +369,7 @@ void main() {
WidgetTest2
(
text:
'child 2'
,
key:
UniqueKey
()),
];
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
final
_WidgetTest0State
state0
=
tester
.
state
(
find
.
byType
(
WidgetTest0
));
final
_WidgetTest1State
state1
=
tester
.
state
(
find
.
byType
(
WidgetTest1
));
...
...
@@ -381,7 +381,7 @@ void main() {
childList
=
createSwitchedChildList
(
childList
,
0
,
1
);
childList
.
removeAt
(
2
);
await
tester
.
pumpWidget
(
SwitchingSliverListTest
(
viewportFraction:
0.1
,
children:
childList
),
SwitchingSliverListTest
(
children:
childList
),
);
expect
(
find
.
text
(
'child 0'
),
findsOneWidget
);
expect
(
find
.
text
(
'child 1'
),
findsOneWidget
);
...
...
@@ -505,12 +505,10 @@ class SwitchingChildListTest extends StatelessWidget {
class
SwitchingSliverListTest
extends
StatelessWidget
{
const
SwitchingSliverListTest
({
required
this
.
children
,
this
.
viewportFraction
=
1.0
,
super
.
key
,
});
final
List
<
Widget
>
children
;
final
double
viewportFraction
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
packages/flutter/test/widgets/snapshot_widget_test.dart
View file @
55b6f049
...
...
@@ -335,10 +335,6 @@ class TestPainter extends SnapshotPainter {
super
.
removeListener
(
listener
);
}
void
notify
()
{
notifyListeners
();
}
@override
void
paintSnapshot
(
PaintingContext
context
,
Offset
offset
,
Size
size
,
ui
.
Image
image
,
Size
sourceSize
,
double
pixelRatio
)
{
count
+=
1
;
...
...
packages/flutter/test_private/bin/test_private.dart
View file @
55b6f049
...
...
@@ -195,7 +195,13 @@ class TestCase {
// Use Flutter's analysis_options.yaml file from packages/flutter.
File
(
path
.
join
(
tmpdir
.
absolute
.
path
,
'analysis_options.yaml'
))
.
writeAsStringSync
(
'include:
${path.toUri(path.join(flutterRoot.path, 'packages', 'flutter', 'analysis_options.yaml'))}
'
);
.
writeAsStringSync
(
'include:
${path.toUri(path.join(flutterRoot.path, 'packages', 'flutter', 'analysis_options.yaml'))}
\n
'
'linter:
\n
'
' rules:
\n
'
// The code does wonky things with the part-of directive that cause false positives.
' unreachable_from_main: false'
);
return
true
;
}
...
...
packages/flutter_test/test/window_test.dart
View file @
55b6f049
...
...
@@ -243,7 +243,6 @@ void main() {
class
TestObserver
with
WidgetsBindingObserver
{
List
<
Locale
>?
locales
;
Locale
?
locale
;
@override
void
didChangeLocales
(
List
<
Locale
>?
locales
)
{
...
...
packages/flutter_tools/bin/xcode_backend.dart
View file @
55b6f049
...
...
@@ -63,11 +63,6 @@ class Context {
}
}
bool
existsDir
(
String
path
)
{
final
Directory
dir
=
Directory
(
path
);
return
dir
.
existsSync
();
}
bool
existsFile
(
String
path
)
{
final
File
file
=
File
(
path
);
return
file
.
existsSync
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
View file @
55b6f049
...
...
@@ -105,7 +105,6 @@ void main() {
testUsingContext
(
'succeeds with iOS device with protocol discovery'
,
()
async
{
final
FakeIOSDevice
device
=
FakeIOSDevice
(
logReader:
fakeLogReader
,
portForwarder:
portForwarder
,
majorSdkVersion:
12
,
onGetLogReader:
()
{
...
...
@@ -167,7 +166,6 @@ void main() {
testUsingContext
(
'succeeds with iOS device with mDNS'
,
()
async
{
final
FakeIOSDevice
device
=
FakeIOSDevice
(
logReader:
fakeLogReader
,
portForwarder:
portForwarder
,
majorSdkVersion:
16
,
onGetLogReader:
()
{
...
...
@@ -237,7 +235,6 @@ void main() {
testUsingContext
(
'succeeds with iOS device with mDNS wireless device'
,
()
async
{
final
FakeIOSDevice
device
=
FakeIOSDevice
(
logReader:
fakeLogReader
,
portForwarder:
portForwarder
,
majorSdkVersion:
16
,
connectionInterface:
DeviceConnectionInterface
.
wireless
,
...
...
@@ -309,7 +306,6 @@ void main() {
testUsingContext
(
'succeeds with iOS device with mDNS wireless device with debug-port'
,
()
async
{
final
FakeIOSDevice
device
=
FakeIOSDevice
(
logReader:
fakeLogReader
,
portForwarder:
portForwarder
,
majorSdkVersion:
16
,
connectionInterface:
DeviceConnectionInterface
.
wireless
,
...
...
@@ -385,7 +381,6 @@ void main() {
testUsingContext
(
'succeeds with iOS device with mDNS wireless device with debug-url'
,
()
async
{
final
FakeIOSDevice
device
=
FakeIOSDevice
(
logReader:
fakeLogReader
,
portForwarder:
portForwarder
,
majorSdkVersion:
16
,
connectionInterface:
DeviceConnectionInterface
.
wireless
,
...
...
@@ -619,7 +614,6 @@ void main() {
testUsingContext
(
'succeeds when ipv6 is specified and debug-port is not on iOS device'
,
()
async
{
final
FakeIOSDevice
device
=
FakeIOSDevice
(
logReader:
fakeLogReader
,
portForwarder:
portForwarder
,
majorSdkVersion:
12
,
onGetLogReader:
()
{
...
...
@@ -1350,11 +1344,10 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
class
FakeIOSDevice
extends
Fake
implements
IOSDevice
{
FakeIOSDevice
({
DevicePortForwarder
?
portForwarder
,
DeviceLogReader
?
logReader
,
this
.
onGetLogReader
,
this
.
connectionInterface
=
DeviceConnectionInterface
.
attached
,
this
.
majorSdkVersion
=
0
,
})
:
_portForwarder
=
portForwarder
,
_logReader
=
logReader
;
})
:
_portForwarder
=
portForwarder
;
final
DevicePortForwarder
?
_portForwarder
;
@override
...
...
@@ -1373,9 +1366,6 @@ class FakeIOSDevice extends Fake implements IOSDevice {
@override
DartDevelopmentService
get
dds
=>
throw
UnimplementedError
(
'getter dds not implemented'
);
final
DeviceLogReader
?
_logReader
;
DeviceLogReader
get
logReader
=>
_logReader
!;
final
DeviceLogReader
Function
()?
onGetLogReader
;
@override
...
...
@@ -1470,11 +1460,9 @@ class FakeMDnsClient extends Fake implements MDnsClient {
}
class
TestDeviceManager
extends
DeviceManager
{
TestDeviceManager
({
required
this
.
logger
})
:
super
(
logger:
logger
);
TestDeviceManager
({
required
super
.
logger
}
);
List
<
Device
>
devices
=
<
Device
>[];
final
BufferLogger
logger
;
@override
List
<
DeviceDiscovery
>
get
deviceDiscoverers
{
final
FakePollingDeviceDiscovery
discoverer
=
FakePollingDeviceDiscovery
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
View file @
55b6f049
...
...
@@ -19,9 +19,7 @@ import '../../src/test_flutter_command_runner.dart';
import
'../../src/testbed.dart'
;
class
FakePub
extends
Fake
implements
Pub
{
FakePub
(
this
.
fs
);
final
FileSystem
fs
;
int
calledGetOffline
=
0
;
int
calledOnline
=
0
;
...
...
@@ -59,7 +57,7 @@ void main() {
setUp
(()
{
testbed
=
Testbed
(
setup:
()
{
fakePub
=
FakePub
(
globals
.
fs
);
fakePub
=
FakePub
();
Cache
.
flutterRoot
=
'flutter'
;
final
List
<
String
>
filePaths
=
<
String
>[
globals
.
fs
.
path
.
join
(
'flutter'
,
'packages'
,
'flutter'
,
'pubspec.yaml'
),
...
...
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
55b6f049
...
...
@@ -831,41 +831,6 @@ class FakeAndroidWorkflow extends Fake implements AndroidWorkflow {
final
bool
appliesToHostPlatform
;
}
class
NoOpDoctor
implements
Doctor
{
@override
bool
get
canLaunchAnything
=>
true
;
@override
bool
get
canListAnything
=>
true
;
@override
Future
<
bool
>
checkRemoteArtifacts
(
String
engineRevision
)
async
=>
true
;
@override
Future
<
bool
>
diagnose
({
bool
androidLicenses
=
false
,
bool
verbose
=
true
,
bool
showColor
=
true
,
AndroidLicenseValidator
?
androidLicenseValidator
,
bool
showPii
=
true
,
List
<
ValidatorTask
>?
startedValidatorTasks
,
bool
sendEvent
=
true
,
FlutterVersion
?
version
,
})
async
=>
true
;
@override
List
<
ValidatorTask
>
startValidatorTasks
()
=>
<
ValidatorTask
>[];
@override
Future
<
void
>
summary
()
async
{
}
@override
List
<
DoctorValidator
>
get
validators
=>
<
DoctorValidator
>[];
@override
List
<
Workflow
>
get
workflows
=>
<
Workflow
>[];
}
class
PassingValidator
extends
DoctorValidator
{
PassingValidator
(
super
.
title
);
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
55b6f049
...
...
@@ -1148,11 +1148,9 @@ void main() {
}
class
TestDeviceManager
extends
DeviceManager
{
TestDeviceManager
({
required
this
.
logger
})
:
super
(
logger:
logger
);
TestDeviceManager
({
required
super
.
logger
}
);
List
<
Device
>
devices
=
<
Device
>[];
final
Logger
logger
;
@override
List
<
DeviceDiscovery
>
get
deviceDiscoverers
{
final
FakePollingDeviceDiscovery
discoverer
=
FakePollingDeviceDiscovery
();
...
...
packages/flutter_tools/test/general.shard/android/android_project_migration_test.dart
View file @
55b6f049
...
...
@@ -9,9 +9,6 @@ import 'package:flutter_tools/src/android/gradle_utils.dart';
import
'package:flutter_tools/src/android/migrations/android_studio_java_gradle_conflict_migration.dart'
;
import
'package:flutter_tools/src/android/migrations/top_level_gradle_build_file_migration.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/base/version.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
...
...
@@ -287,8 +284,3 @@ class FakeErroringJava extends FakeJava {
throw
Exception
(
'How did this happen?'
);
}
}
class
FakeFileSystem
extends
Fake
implements
FileSystem
{}
class
FakeProcessUtils
extends
Fake
implements
ProcessUtils
{}
class
FakePlatform
extends
Fake
implements
Platform
{}
class
FakeOperatingSystemUtils
extends
Fake
implements
OperatingSystemUtils
{}
packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
View file @
55b6f049
...
...
@@ -4,12 +4,10 @@
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/android/android_sdk.dart'
;
import
'package:flutter_tools/src/android/android_studio.dart'
;
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:test/fake.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -424,13 +422,3 @@ ro.build.version.incremental=1624448
ro.build.version.sdk=24
ro.build.version.codename=REL
'''
;
class
FakeAndroidStudioWithJdk
extends
Fake
implements
AndroidStudio
{
@override
String
?
get
javaPath
=>
'/fake/android_studio/java/path/'
;
}
class
FakeAndroidStudioWithoutJdk
extends
Fake
implements
AndroidStudio
{
@override
String
?
get
javaPath
=>
null
;
}
packages/flutter_tools/test/general.shard/artifact_updater_test.dart
View file @
55b6f049
...
...
@@ -371,7 +371,7 @@ void main() {
});
testWithoutContext
(
'ArtifactUpdater will de-download a file if unzipping fails on windows'
,
()
async
{
final
FakeOperatingSystemUtils
operatingSystemUtils
=
FakeOperatingSystemUtils
(
windows:
true
);
final
FakeOperatingSystemUtils
operatingSystemUtils
=
FakeOperatingSystemUtils
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
ArtifactUpdater
artifactUpdater
=
ArtifactUpdater
(
...
...
@@ -421,7 +421,7 @@ void main() {
});
testWithoutContext
(
'ArtifactUpdater will bail if unzipping fails more than twice on Windows'
,
()
async
{
final
FakeOperatingSystemUtils
operatingSystemUtils
=
FakeOperatingSystemUtils
(
windows:
true
);
final
FakeOperatingSystemUtils
operatingSystemUtils
=
FakeOperatingSystemUtils
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
ArtifactUpdater
artifactUpdater
=
ArtifactUpdater
(
...
...
@@ -529,10 +529,7 @@ void main() {
}
class
FakeOperatingSystemUtils
extends
Fake
implements
OperatingSystemUtils
{
FakeOperatingSystemUtils
({
this
.
windows
=
false
});
int
failures
=
0
;
final
bool
windows
;
/// A mapping of zip [file] paths to callbacks that receive the [targetDirectory].
///
...
...
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
55b6f049
...
...
@@ -1204,7 +1204,7 @@ class FakeSimControl extends Fake implements SimControl {
@override
Future
<
RunResult
>
launch
(
String
deviceId
,
String
appIdentifier
,
[
List
<
String
>?
launchArgs
])
async
{
requests
.
add
(
LaunchRequest
(
deviceId
,
appIdentifier
,
launchArgs
));
requests
.
add
(
LaunchRequest
(
appIdentifier
,
launchArgs
));
return
RunResult
(
ProcessResult
(
0
,
0
,
''
,
''
),
<
String
>[
'test'
]);
}
...
...
@@ -1215,9 +1215,8 @@ class FakeSimControl extends Fake implements SimControl {
}
class
LaunchRequest
{
const
LaunchRequest
(
this
.
deviceId
,
this
.
appIdentifier
,
this
.
launchArgs
);
const
LaunchRequest
(
this
.
appIdentifier
,
this
.
launchArgs
);
final
String
deviceId
;
final
String
appIdentifier
;
final
List
<
String
>?
launchArgs
;
}
packages/flutter_tools/test/general.shard/terminal_handler_test.dart
View file @
55b6f049
...
...
@@ -1496,7 +1496,6 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler { }
class
TestRunner
extends
Fake
implements
ResidentRunner
{
bool
hasHelpBeenPrinted
=
false
;
String
?
receivedCommand
;
@override
Future
<
void
>
cleanupAfterSignal
()
async
{
}
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
55b6f049
...
...
@@ -1211,11 +1211,9 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler {
}
class
FakeDwds
extends
Fake
implements
Dwds
{
FakeDwds
(
this
.
connectedAppsIterable
)
:
FakeDwds
(
Iterable
<
AppConnection
>
connectedAppsIterable
)
:
connectedApps
=
Stream
<
AppConnection
>.
fromIterable
(
connectedAppsIterable
);
final
Iterable
<
AppConnection
>
connectedAppsIterable
;
@override
final
Stream
<
AppConnection
>
connectedApps
;
...
...
packages/flutter_tools/test/general.shard/web/devices_test.dart
View file @
55b6f049
...
...
@@ -394,12 +394,6 @@ void main() {
class
TestChromiumLauncher
implements
ChromiumLauncher
{
TestChromiumLauncher
();
bool
_hasInstance
=
false
;
void
setInstance
(
Chromium
chromium
)
{
_hasInstance
=
true
;
currentCompleter
.
complete
(
chromium
);
}
@override
Completer
<
Chromium
>
currentCompleter
=
Completer
<
Chromium
>();
...
...
@@ -417,7 +411,7 @@ class TestChromiumLauncher implements ChromiumLauncher {
}
@override
bool
get
hasChromeInstance
=>
_hasInstanc
e
;
bool
get
hasChromeInstance
=>
fals
e
;
@override
Future
<
Chromium
>
launch
(
...
...
packages/flutter_tools/test/general.shard/xcode_backend_test.dart
View file @
55b6f049
...
...
@@ -234,11 +234,6 @@ class TestContext extends Context {
String
stdout
=
''
;
String
stderr
=
''
;
@override
bool
existsDir
(
String
path
)
{
return
fileSystem
.
directory
(
path
).
existsSync
();
}
@override
bool
existsFile
(
String
path
)
{
return
fileSystem
.
file
(
path
).
existsSync
();
...
...
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