{"id":1983,"date":"2022-04-07T06:56:40","date_gmt":"2022-04-07T06:56:40","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1983"},"modified":"2022-04-07T06:56:40","modified_gmt":"2022-04-07T06:56:40","slug":"state-management-widget","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/04\/07\/state-management-widget\/","title":{"rendered":"State Management Widget"},"content":{"rendered":"\n<p>In Flutter, there are mainly two types of widget:<\/p>\n\n\n\n<ul><li>StatelessWidget<\/li><li>StatefulWidget<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">StatefulWidget<\/h3>\n\n\n\n<p>A StatefulWidget has state information. It contains mainly two classes: the&nbsp;<strong>state object<\/strong>&nbsp;and the&nbsp;<strong>widget<\/strong>. It is dynamic because it can change the inner data during the widget lifetime. This widget does not have a&nbsp;<strong>build()<\/strong>&nbsp;method. It has&nbsp;<strong>createState()<\/strong>&nbsp;method, which returns a class that extends the Flutters State Class. The examples of the StatefulWidget are Checkbox, Radio, Slider, InkWell, Form, and TextField.<\/p>\n\n\n\n<p><strong>Example<\/strong><a href=\"https:\/\/www.javatpoint.com\/flutter-widgets#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-widgets#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-widgets#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Car extends StatefulWidget {  \n  const Car({ Key key, this.title }) : super(key: key);   \n  \n  @override  \n  _CarState createState() => _CarState();  \n}  \n  \nclass _CarState extends State&lt;Car> {  \n  @override  \n  Widget build(BuildContext context) {  \n    return Container(  \n      color: const Color(0xFEEFE),  \n           child: Container(  \n            child: Container( \/\/child: Container() )  \n        )  \n    );  \n  }  \n}  <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">StatelessWidget<\/h3>\n\n\n\n<p>The StatelessWidget does not have any state information. It remains static throughout its lifecycle. The examples of the StatelessWidget are Text, Row, Column, Container, etc.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class MyStatelessCarWidget extends StatelessWidget {  \n  const MyStatelessCarWidget ({ Key key }) : super(key: key);  \n  \n  @override  \n  Widget build(BuildContext context) {  \n    return Container(color: const Color(0x0xFEEFE));  \n  }  \n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In Flutter, there are mainly two types of widget: StatelessWidget StatefulWidget StatefulWidget A StatefulWidget has state information. It contains mainly two classes: the&nbsp;state object&nbsp;and the&nbsp;widget. It is dynamic because it can change the inner data during the widget lifetime. This widget does not have a&nbsp;build()&nbsp;method. It has&nbsp;createState()&nbsp;method, which returns a class that extends the Flutters [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[675],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1983"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1983"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1983\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}