skip to Main Content

I’m developing app in flutter and did firebase configuration to my flutter app.Using IDE – VSCode, Firebase configuration for flutter project.

I’m getting error all time:

zsh: command not found: flutterfire, giving error Undefined name ‘DefaultFirebaseOptions’.
Try correcting the name to one that is defined, or defining the name.dart
undefined_identifier

This is my code –

import 'firebase_options.dart';


Future<void> main() async {`enter code here`
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  
  runApp(const MyApp());
}
        

I’m getting error all time

    logcat ==

    getting error -  zsh: command not found: flutterfire
    
         flutterfire configure
        zsh: command not found: flutterfire

2

Answers


  1. Chosen as BEST ANSWER
    follow the Homebrew installation steps -
    
    % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    check for % brew --version
    
    if it produce error : zsh: command not found: brew 
    
    then install git using cmd :
    
    % brew install git
    
    it may give this error again : zsh: command not found: brew
    
    then again check for :  
    
    % git --version
    
    if git installed will show this : git version 2.39.3 (Apple Git-146)
    
    then run cmd to export path : % export PATH="/opt/homebrew/bin:$PATH"
    
    print path : check this cmd
    
    % echo $PATH
    
    it will take few min
    
    after that run cmd to install git
    
    % brew install git
    
    it will download files
    
    you will see 
    
    - zsh completions and functions have been installed to:
      /opt/homebrew/share/zsh/site-functions
    
    check for version :
    
    % brew --version
    
    Homebrew 4.3.14
    
    Cheers:  zsh: command not found: brew issue fixed now!
    

  2. Error says that flutterfire CLI is not properly configured in your environment. As per documentation, you have to install it in this manner:

    dart pub global activate flutterfire_cli
    

    This command will add flutterfire command to your path and it will be accessible in your build.
    You should also restart your IDE after that, just in case some problems with PATH.

    After all that manipulations, flutterfire should be accessible from your terminal, check it like that:

    flutterfire --help
    A CLI tool for FlutterFire projects.
    
    Usage: flutterfire <command> [arguments]
    
    Global options:
    -h, --help       Print this usage information.
        --verbose    Enable verbose logging.
    -v, --version    Print the current CLI version.
    
    Available commands:
      configure     Configure Firebase for your Flutter app. This command will fetch Firebase configuration for you and generate a Dart file with prefilled FirebaseOptions you can use.
      reconfigure   Updates the configurations for all build variants included in the "firebase.json" added by running `flutterfire configure`.
      update        Update the version of firebase plugins in your pubspec to the latest version and clean your workspace to ensure that everything works properly.
    
    Run "flutterfire help <command>" for more information about a command.
    

    Also, it’s crucial to add .pub-cache to you PATH. It is usually in $HOME/.pub-cache/bin

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search