Skip to content

Commit

Permalink
Avoid ever creating the WidgetInspectorService outside of debug mode. (
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob314 authored Sep 10, 2018
1 parent 9dce4b8 commit eeebd83
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions packages/flutter/lib/src/widgets/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit eeebd83

Please sign in to comment.