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
Error says that
flutterfire
CLI is not properly configured in your environment. As per documentation, you have to install it in this manner: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:Also, it’s crucial to add
.pub-cache
to youPATH
. It is usually in$HOME/.pub-cache/bin