Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Auth Web Error. Error: The argument type 'Future<void> Function()' can't be assigned to the parameter type 'Future<void> Function(App)?'

First of all, this is the error that I encountered:

/C:/Users/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_auth_web-5.2.2/lib/firebase_auth_web.dart:92:45: Error: The argument type 'Future Function()' can't be assigned to the parameter type 'Future Function(App)?'.

  • 'Future' is from 'dart:async'.
  • 'App' is from 'package:firebase_core_web/src/interop/app.dart' ('/C:/Users/Grace%20Computer/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core_web-2.2.2/lib/src/interop/app.dart'). app.dart:1 FirebaseCoreWeb.registerService('auth', () async { ^

Failed to compile application.

I am trying to run a flutter login application on web. I have pasted the required creditentials as on the web>index.html file. The main.dart file looks like this:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
      options: const FirebaseOptions(
          apiKey: "AIzaSyDZvxw2LXy05hLkcH_fpPWWa5RzwVlbQro",
          projectId: "messageapp-acf7a",
          messagingSenderId: "72207922701",
          appId: "1:72207922701:web:d84fe3144a7f2de5dd4744"
          ),
          );
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: SignupPage(),
    );
  }
}

The relevant parts of pubspec.yaml file is this:

name: frontend_msngr
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=2.19.2 <3.0.0'


dependencies:
  flutter:
    sdk: flutter
  chat_bubbles: 
  firebase_core: 
  cupertino_icons: ^1.0.2
  firebase_auth: 
  firebase_auth_web:

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true```

Since,the file that got the error is lib/firebase_auth_web.dart , I don't know how I passed incorrect parameters (as suggested by the error).



I tried changing the versions a bitbut it didn't work for me. 
like image 764
prabinlamsal19 Avatar asked Dec 12 '25 11:12

prabinlamsal19


1 Answers

Run

flutter pub upgrade --major-versions
like image 142
krishnaacharyaa Avatar answered Dec 15 '25 01:12

krishnaacharyaa