Avoid ever creating the WidgetInspectorService outside of debug mode. (#21648)

This commit is contained in:
Jacob Richman
2018-09-10 15:20:22 -07:00
committed by GitHub
parent 9dce4b8259
commit eeebd8332a

View File

@@ -293,20 +293,23 @@ abstract class WidgetsBinding extends BindingBase with SchedulerBinding, Gesture
}
);
// This service extension is deprecated and will be removed by 7/1/2018.
// Use ext.flutter.inspector.show instead.
registerBoolServiceExtension(
name: 'debugWidgetInspector',
getter: () async => WidgetsApp.debugShowWidgetInspectorOverride,
setter: (bool value) {
if (WidgetsApp.debugShowWidgetInspectorOverride == value)
return new Future<Null>.value();
WidgetsApp.debugShowWidgetInspectorOverride = value;
return _forceRebuild();
}
);
assert(() {
// This service extension is deprecated and will be removed by 7/1/2018.
// Use ext.flutter.inspector.show instead.
registerBoolServiceExtension(
name: 'debugWidgetInspector',
getter: () async => WidgetsApp.debugShowWidgetInspectorOverride,
setter: (bool value) {
if (WidgetsApp.debugShowWidgetInspectorOverride == value)
return new Future<Null>.value();
WidgetsApp.debugShowWidgetInspectorOverride = value;
return _forceRebuild();
}
);
WidgetInspectorService.instance.initServiceExtensions(registerServiceExtension);
WidgetInspectorService.instance.initServiceExtensions(registerServiceExtension);
return true;
}());
}
Future<Null> _forceRebuild() {