debugger seems to auto hot reload after hot restart
See original GitHub issueDescribe the bug
Run the follow simple code:
import 'package:flutter/material.dart';
class TestWidgetLifeCycle extends StatefulWidget {
TestWidgetLifeCycle({Key key}) : super(key: key);
@override
_TestWidgetLifeCycleState createState() => _TestWidgetLifeCycleState();
}
class _TestWidgetLifeCycleState extends State<TestWidgetLifeCycle> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Widget Life Cycle'),
),
body: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
onPressed: () {
setState(() {});
},
child: Text('setState'),
)
],
),
_TestStatefulWidgetLifeCycle(),
],
),
);
}
}
class _TestStatefulWidgetLifeCycle extends StatefulWidget {
_TestStatefulWidgetLifeCycle({Key key}) : super(key: key) {
print('[#${identityHashCode(this)}][stateful widget] call constructor!');
}
@override
StatefulElement createElement() {
print('[#${identityHashCode(this)}][stateful widget] call createElement!');
return super.createElement();
}
@override
__TestStatefulWidgetLifeCycleState createState() {
print('[#${identityHashCode(this)}][stateful widget] call create state!');
return __TestStatefulWidgetLifeCycleState();
}
}
class __TestStatefulWidgetLifeCycleState
extends State<_TestStatefulWidgetLifeCycle> {
@override
void initState() {
super.initState();
print('[#${identityHashCode(this)}][stateful widget state] init state!');
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
print(
'[#${identityHashCode(this)}][stateful widget state] call didChangeDependencies!');
}
@override
void didUpdateWidget(covariant _TestStatefulWidgetLifeCycle oldWidget) {
super.didUpdateWidget(oldWidget);
print(
'[#${identityHashCode(this)}][stateful widget state] call didUpdateWidget!');
}
@override
void dispose() {
print('[#${identityHashCode(this)}][stateful widget state] dispose!');
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
child: Text('stateful widget'),
);
}
}
The Stateful Widget seems to be updated caused by run command hot reload
:
If I run hot reload, result in:
Versions (please complete the following information):
- VS Code version: 1.55.0-insider (Universal)
- Dart extension version: v3.20.1
- Dart/Flutter SDK version: Flutter 2.0.3, Dart 2.12.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Write and debug code by using Hot Reload - Visual Studio ...
Open a project based on a supported application type. · Make sure that Enable native code debugging is disabled in the debugger settings...
Read more >Hot reload - Flutter documentation
Only Flutter apps in debug mode can be hot reloaded or hot restarted. Modify one of the Dart files in your project. Most...
Read more >Debug sessions often terminate during a hot restart after ...
Describe the bug Hot reload works flawlessly on 1.65.2 but upgrading to 1.66 cause frequent disconnection of debugger after few seconds.
Read more >VSCode hot reload for Flutter does not work - Stack Overflow
To solve the issue first close the running debugging session using Shift+f5. Then click debug from the menu bar. Click Start without debugging....
Read more >Edit running code with Hot Reload - JetBrains Rider
Hot Reload, also known as Edit & Continue. Learn how to make changes while running and debugging without restarting the session.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure what changed to fix it, but glad it seems to be resolved. If it comes back, please let me know. Thanks!
This seems to be fixed in latest extension.