showMyDialog function Null safety

Future<void> showMyDialog(
  1. BuildContext context,
  2. String title,
  3. String text,
  4. String text2
)

error dialog

Implementation

Future<void> showMyDialog(
    BuildContext context, String title, String text, String text2) {
  return showDialog(
    context: context,
    barrierDismissible: true,
    builder: (BuildContext allertcontext) {
      return AlertDialog(
        title: Text(title),
        content: SingleChildScrollView(
          child: ListBody(
            children: <Widget>[
              Text(text),
              Text(text2),
            ],
          ),
        ),
      );
    },
  );
}