Getting HandshakeException in dart

I am working on flutter to develop an android app to post data to InfluxDB. My android version is v7.0 and am unable to update on my tablet. I am currently getting the exception ‘HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: certificate has expired(’

I have tried using the code below but it still does not work. Is there anything else I can do? Thank you in advance.

class DevHttpOverrides extends HttpOverrides {
  HttpClient createHttpClient(SecurityContext? context) {
    return super.createHttpClient(context)
      ..badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;

Future<void> main() async {
  // Required for background service
  // await initializeService(); // Do this later when all permissions are initialized = DevHttpOverrides();
  runApp(const MyApp());

Hello @matassabaliauskas,
That’s so cool that you’re making an app.
I recommend checking out this example:

What type of android app are you making?