I need android and ios configure support for this issue solving.
Issue:
I try to configure firebase emulator in flutter to web, android and ios. successfully i configured production code to all these three platform. but, i tried to configure emulator unfortunately only one solution available for web. no documentation available android and ios platform. help me to fix this issue.
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// Create the initialization Future outside of `build`:
final Future<FirebaseApp> _initialization = Firebase.initializeApp();
@override
Widget build(BuildContext context) {
return FutureBuilder(
// Initialize FlutterFire:
future: _initialization,
builder: (context, snapshot) {
// Check for errors
if (snapshot.hasError) {
return Text("Error!");
}
// Once complete, show your application
if (snapshot.connectionState == ConnectionState.done) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyWelcomePage(),
);
}
// Otherwise, show something whilst waiting for initialization to complete
return Text("Loading...");
},
);
}
}
web configure:
<script src="https://www.gstatic.com/firebasejs/8.2.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.1/firebase-firestore.js"></script>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
var firebaseConfig = {
apiKey: ".............PeM4u8O3pwdW0llsih8Qbk",
authDomain: ".........-284111.firebaseapp.com",
databaseURL: "https://..........-284111.firebaseio.com",
projectId: "..........-284111",
storageBucket: "...........-284111.appspot.com",
messagingSenderId: "........995279",
appId: "1:..........:web:.........f569a53ba",
measurementId: "G-......N16FT"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.auth().useEmulator('http://localhost:9099/');
firebase.firestore().useEmulator("localhost", 8080);
</script>
<script src="main.dart.js" type="application/javascript"></script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…