FLUTTER – TypeError: Class constructor IndexedDBLocalPersistence cannot be invoked without ‘new’

Team,

I have been initializing Firebase like this since I started by following this flutter documentation, but for some reason this throws an error in the debugger, as follows:

TypeError: Class constructor IndexedDBLocalPersistence cannot be
invoked without ‘new’

Could you please help me rectify this?

Here is the Flutter code:

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:pace/firebase_options.dart';
import 'package:pace/pages/auth_page.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: AuthPage(),
      ),
    );
  }
}

  • What is the Dart SDK version constraint in your pubspec.yaml file?

    – 

  • sdk: ‘>=3.3.0-147.0.dev <4.0.0’

    – 

  • That sounds like a Flutter SDK version. The current stable version of Dart is 3.2.4.

    – 




  • How can we fix this?

    – 

  • Once again: what is the Dart version specified in your pubspec.yaml file? Better yet, edit your question and post the entire filee.

    – 




Leave a Comment