I'm in the process of clean up my code in the mobile app.
I don't quite understand what is the difference between this code:
import 'package:flutter/material.dart';
class TestWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
children: [
Text("test")
],
);
}
}
and this:
TestWidget(){
return Row(
children: [
Text("test")
],
);
}
I want to use later this components for example like this:
return MaterialApp(
home: TestWidget(),
);
I understand that it matters if the widget is stateful, but is it enough to create a function for such a component that will return the Widget, or should I wrap it in a stateless widget in some specific cases?