Flutter Firebase fails to launch and drops

Asked 1 years ago, Updated 1 years ago, 265 views

We built the environment with Firebase cli.
The dropout stops before it is built.
The same error occurred when I created a new blog and ran it in the same environment.
firebase_core:^1.24.0

error message

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface- 
   4.5.1/lib/src/pigeon/messages.pigeon.dart:242:7:Error: 'clathrow' isn't a type.
      US>clathrow PlatformException(
      ^^^^^^^^
    /C: /flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface- 
   4.5.1/lib/src/pigeon/messages.pigeon.dart:242:16:Error:Expected'; 'after this.
      US>clathrow PlatformException(
               ^^^^^^^^^^^^^^^^^
    /C: /flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface- 
   4.5.1/lib/src/pigeon/messages.pigeon.dart:243:13:Error:Expected') 'before this.

        code: 'null-error',
            ^
    /C: /flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface- 
    4.5.1/lib/src/pigeon/messages.pigeon.dart:243:9:Error:The getter'code'isn't defined 
    for the class 'FirebaseCoreHostApi'.
    - 'FirebaseCoreHostApi' is from 
    'package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart' 
    ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface- 
    4.5.1/lib/src/pigeon/messages.pigeon.dart')
    package:firebase_core_platform_interface/.../pigeon/messages.pigeon.dart:1
    Try correcting the name to the name of an existing getter, or defining a getter or field 
    named 'code'.

        code: 'null-error',
        ^^^^
    /C: /flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-        
    4.5.1/lib/src/pigeon/messages.pigeon.dart:222:33:Error: Anon-null value must be 
    returned since the return type 'PigeonFirebaseOptions' does not allow null.
    - 'PigeonFirebaseOptions' is from 
    'package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart'     
    ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-    
    4.5.1/lib/src/pigeon/messages.pigeon.dart')
    package:firebase_core_platform_interface/.../pigeon/messages.pigeon.dart:1
      Future<PigeonFirebaseOptions>optionsFromResource()async{
                                ^
    3

    FAILURE—Build failed with an exception.

    * Where:
    Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

    * What was wrong:
    Execution failed for task':app:compileFlutterBuildDebug'.
    >Process 'command' C:\flutter\bin\flutter.bat' 'finished with non-zero exit value 1

    * Try:
    >Run with -- stacktrace option to get the stack trace.
    >Run with -- info -- debug option to get more log output.
    >Run with -- scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 33s
    Exception—Gradle task assemblyDebug failed with exit code 1
    Exited(sigterm)

main.dart

import'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

import 'firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  wait Firebase.initializeApp(
    options —DefaultFirebaseOptions.currentPlatform,
   );
  runApp(const MyApp());
}
class MyApp extensions StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build (BuildContext context) {
    US>return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwitch:Colors.blue,
      ),
      home:const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extensions StatefulWidget{
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage>createState()=>_MyHomePageState();
}

class_MyHomePageState extensions State<MyHomePage>{
  int_counter = 0;

  void_incrementCounter(){
    setState((){
      _counter++;
    });
  }

  @override
  Widget build (BuildContext context) {
    US>return Scaffold(
      appBar —AppBar(
        title:Text(widget.title),
      ),
      body: Center(
        child —Column(
          mainAxisAlignment—MainAxisAlignment.center,
          children:<Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style:Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed:_incrementCounter,
        tooltip: 'Increment',
        child —const Icon (Icons.add),
      ),
    );
  }
}

firebase flutter

2022-10-22 09:15

1 Answers

I don't know the root cause, but after reinstalling Flutter itself, I was able to run it without any problems.


2022-10-22 09:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.