(I am sorry I can only post a portion of my code, I hope what I have here is enough.)
In this code, I need to call buildApiBox into the page_ApiBox class. But I also need to pass apibox.api_key which is already connected to a variable in a different class.
Any advice is appreciated. I am new to Flutter/Dart.
(Part of) My Code:
class page_ApiBox extends StatefulWidget {
const page_ApiBox({Key? key}) : super(key: key);
@override
State<page_ApiBox> createState() => _page_ApiBoxState();
}
class _page_ApiBoxState extends State<page_ApiBox> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: buildApiBox(context, apibox)
);
}
}
Widget buildApiBox(BuildContext context, apiBox apibox) {
return Scaffold(
appBar: AppBar(
title: Text('API BOX')
),
body: Text(apibox.api_key) //I need to display what is inside the variable
);
}
Here is a photo of my code. As you can see, apibox in line 90 is undefined.
