'Flutter: Id does not exist when try to run my code

I have a Flutter application and when I try to run my code, it throw a warning that says the id does not exist.

How can I get out of this warning?

======== Exception caught by Flutter framework =====================================================

The following assertion was thrown during a service extension callback for "ext.flutter.inspector.setSelectionById":
Id does not exist.

When the exception was thrown, this was the stack:

dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49  throw_
packages/flutter/src/widgets/widget_inspector.dart 1297:7                     toObject
packages/flutter/src/widgets/widget_inspector.dart 1359:25                    setSelectionById
packages/flutter/src/widgets/widget_inspector.dart 867:35                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54            runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5            _async
packages/flutter/src/widgets/widget_inspector.dart 864:38                     <fn>
packages/flutter/src/foundation/binding.dart 602:32                           <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
dart-sdk/lib/async/zone.dart 1687:54                                          runUnary
dart-sdk/lib/async/future_impl.dart 160:18                                    handleValue
dart-sdk/lib/async/future_impl.dart 767:44                                    handleValueCallback
dart-sdk/lib/async/future_impl.dart 796:13                                    _propagateToListeners
dart-sdk/lib/async/future_impl.dart 593:7                                     [_complete]
dart-sdk/lib/async/future.dart 390:15                                         <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19       internalCallback
====================================================================================================


Solution 1:[1]

  • Close the app on your device.

  • Shift + F5 to stop the app or just stop the app

  • start up again

Solution 2:[2]

Try this:

flutter pub global activate devtools
delete .dart_devtool folder
flutter clean
flutter pub get
run app

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Mortensen
Solution 2 Peter Mortensen