To remove Firebase from a Flutter project, you need to perform the following steps:
- Remove Firebase dependencies from pubspec.yaml file:
- Run the command:
- Remove the Firebase configuration files:
- Remove Firebase initialization code:
- Clean the project:
- Build and run the project:
dependencies:
flutter:
sdk: flutter
firebase_core: ^1.7.0
firebase_auth: ^3.3.0
cloud_firestore: ^3.1.0
firebase_messaging: ^11.2.2
firebase_analytics: ^10.2.0
firebase_crashlytics: ^2.5.6
firebase_performance: ^3.3.0
Remove the above Firebase dependencies from the pubspec.yaml file.
flutter pub get
Inside the android/app directory, delete the google-services.json file.
Inside the ios/Runner directory, delete the GoogleService-Info.plist file.
Open the lib/main.dart file and remove the Firebase initialization code, which typically looks like this:
import 'package:firebase_core/firebase_core.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
Remove the above code block from the main() function.
Run the command:
flutter clean
Finally, build and run your project using the command:
flutter run
After completing these steps, Firebase should be removed from your Flutter project.