Answers for "Flutter Stateless Widget"

2

make stateful widget flutter

class MyClass extends StatefulWidget {
	@override
    MyClassState createState() => new MyClassState();
}

class MyClassState extends State<MyClass> {
	//Widgets and other code here
}
Posted by: Guest on May-13-2020
0

Flutter Stateless Widget

import 'package:flutter/material.dart';

void main() {
    runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Hello world!',
      home: Scaffold(
        body: Center(
          child: Text('Hello world'),
        ),
      ),
    );
  }
}
Posted by: Guest on October-23-2021

Browse Popular Code Answers by Language