Reputation: 1165
I am rewriting my code because I have to see some changes But when I change my code and "hot reload" it does not get reflected in emulator.
Everytime I need to full restart the app
import 'package:flutter/material.dart';
Dialog leadDialog = Dialog(
child: Container(
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.all(15.0),
child: Text(
'Leaderboard',
style: TextStyle(color: Colors.black, fontSize: 22.0),
),
),
Divider(color: Colors.redAccent),
Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Padding(
padding: EdgeInsets.all(15.0),
child: CircleAvatar(
radius: 30.0,
backgroundImage: ExactAssetImage('assets/cat.jpg')),
),
Text('Neha'),
RaisedButton(
padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0),
textColor: Colors.black,
child: Text(
'546',
style: TextStyle(),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
),
])
],
)),
);
Expected: On hot reload I should be able to see the changes.
Upvotes: 2
Views: 2075
Reputation: 795
I had the very same problem. The following steps worked for me
flutter clean
Upvotes: 0
Reputation: 915
If you store your widget in a variable outside the WidgetLifeCycle it would probably wouldn't render every state change. Maybe make your widget a builder method that will render every single time its parent renders.
Also read about FlutterByExample - Widget Lifecycle, Flutter Docs Widget Intro
WidgetBuilder leadDialog = (BuildContext context) => Dialog();
Upvotes: 1