I want to call functions with my classes constructor arguments before passing them to the super
method.
Here is a simplified version of my code:
class CustomScaffold extends Scaffold {
@override
final Widget body;
const CustomScaffold({required this.body, Key? key})
: super(key: key, body: _buildBody()); // <--- it doesnt like this
Widget _buildBody() {
return Center(child: body);
}
}
This is the error that I am getting from AndroidStudio:
error: The instance member '_buildBody' can't be accessed in an initializer. (implicit_this_reference_in_initializer at [bordns_client] lib/ui/base.dart:11)
What is are the best practices for this sort of thing?