mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add assert that the root widget has been attached. (#32437)
This commit is contained in:
parent
40300fb8a9
commit
069303d46f
@ -736,6 +736,12 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
|
||||
).attachToRenderTree(buildOwner, renderViewElement);
|
||||
}
|
||||
|
||||
/// Whether the [renderViewElement] has been initialized.
|
||||
///
|
||||
/// This will be false until [runApp] is called (or [WidgetTester.pumpWidget]
|
||||
/// is called in the context of a [TestWidgetsFlutterBinding]).
|
||||
bool get isRootWidgetAttached => _renderViewElement != null;
|
||||
|
||||
@override
|
||||
Future<void> performReassemble() {
|
||||
assert(() {
|
||||
|
||||
@ -175,6 +175,8 @@ class FlutterDriverExtension {
|
||||
/// the result into a subclass of [Result], but that's not strictly required.
|
||||
@visibleForTesting
|
||||
Future<Map<String, dynamic>> call(Map<String, String> params) async {
|
||||
assert(WidgetsBinding.instance.isRootWidgetAttached,
|
||||
'No root widget is attached; have you remembered to call runApp()?');
|
||||
final String commandKind = params['command'];
|
||||
try {
|
||||
final CommandHandlerCallback commandHandler = _commandHandlers[commandKind];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user