Is there a diference between a function that returns a widget and the Extract Widget that create a class? in terms of performance, best practices, etc.
At first sight I would prefer the function, because is les bulky, but I want to hear your opinions.
Custom Function
Container box() {
return Container(
margin: EdgeInsets.all(15.0),
);
}
This is produced by using the Extract Widget
class BoxExtracted extends StatelessWidget {
const BoxExtracted({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(15.0),
);
}
}