I have a widget that is going to use the flutter_sound package to record audio: https://flutter-sound.canardoux.xyz/readme.html
I set up the stateless widget, then used Android Studio's context actions to convert it to a stateful one. Then, I added the await
keyword to match this example from the documentation: https://flutter-sound.canardoux.xyz/tau_api_recorder_open_audio_session.html
Android studio then gave an error that said I needed to convert the widget's build function to an async function. When I did so (via the context action), it gave another error: '_MsgInputState.build' ('Future<Widget> Function(BuildContext)') isn't a valid override of 'State.build' ('Widget Function(BuildContext)')
class _MsgInputState extends State<MsgInput> {
final database = FirebaseDatabase.instance.reference();
final auth = AuthService();
@override
Future<Widget> build(BuildContext context) async { //error points to the 'build' keyword here
final messageDao = MessageDao(groupIDPath: widget.groupIDPath);
final groupChatRef = database.child('groupChats/0exUS3P2XKFQ007TIMmm'); //TODO: Remove hardcoded value
final messageController = TextEditingController();
var myRecorder = await FlutterSoundRecorder().openAudioSession();
@override
void dispose() {
myRecorder.closeAudioSession();
super.dispose();
}
return Scaffold(
...
)
}
}