How to Add username/passwords to google chrome(internal) on device using an Flutter application?
I have built a flutter application to store, edit and manage username/passwords using google cloud firestore. The user can login through his google account and store his details. Further, I need to extend it to make the application to store credentials internally in the device such that, when I try to login in another app / browser, The passwords stored in my flutter app shows in the autofill/recommended filed in any textfields outside of the app. Are there any ways to do like that ?
See also questions close to this topic
-
Flutter Riverpod : Problems fetching data from Firebase using Riverpod
I'm changing from Getx to Riverpod. So, Problems fetching data from Firebase using Riverpod.
I have two product data on the server. Initially after running, the ProductListPage doesn't show anything. Enter the page again and the list will be displayed. And every time you enter, the list is piled up. How to fetch data from server using Riverpod?
Model
class Product { String id; String name; String category; String image; String images; String desc; String price; Timestamp createdAt; Timestamp updatedAt; Product(); Product.fromMap(Map<String, dynamic> data) { id = data['id'] ?? "ID Data Null"; name = data['name'] ?? "Name Data Null"; category = data['category'] ?? "Category Data Null"; image = data['image'] ?? "Image Data Null"; //images = data['images']; desc = data['desc'] ?? "Desc Data Null"; price = data['price'] ?? "Price Data Null"; createdAt = data['createdAt']; updatedAt = data['updatedAt']; } Map<String, dynamic> toMap() { return { 'id': id, 'name': name, 'category': category, 'images': images, 'image': image, 'desc': desc, 'price': price, 'createdAt': createdAt, 'updatedAt': updatedAt }; } }
Riverpod Provider
final productListProvider = StateNotifierProvider<ProductList>((ref) { return ProductList(); }); class ProductList extends StateNotifier<List<Product>> { //static Product productModel = Product(); ProductList([List<Product> state]) : super(state ?? []); productAdd(Product product) { state.add(product); } Future<void> refreshList() async { getStateProducts(); } getStateProducts() async { QuerySnapshot snapshot = await FirebaseFirestore.instance .collection('Products') .get(); snapshot.docs.forEach((document) { Product _product = Product.fromMap(document.data()); productAdd(_product); print('DataBase: ${_product.name}'); }); }
ProductPage ListView
class ProductListPage extends ConsumerWidget { @override Widget build(BuildContext context, ScopedReader watch) { final productObj = watch(productListProvider); final product = watch(productListProvider.state); productObj.getStateProducts(); // return Scaffold( appBar: AppBar( title: Text('Product List'), ), body: new RefreshIndicator( child: ListView.separated( itemBuilder: (BuildContext context, int index) { return ListTile( leading: Image.network( product[index].image != null ? product[index].image : 'https://www.testingxperts.com/wp-content/uploads/2019/02/placeholder-img.jpg', width: 120, fit: BoxFit.fitWidth, ), title: Text(product[index].name), subtitle: Text(product[index].category), onTap: () { // getxController.currentIndex(index); // getxController.currentProduct = // getxController.productList[index]; // return Get.to(ProductDetail(), arguments: "test"); }, ); }, itemCount: product.length, separatorBuilder: (BuildContext context, index) { return Divider( color: Colors.black, ); }, ), onRefresh: productObj.refreshList), // Refresh ); } }
-
Next.js with firebase: SSR and SSO
I am currently working on a website that has its data stored in firestore. The website needs good SEO, so I chose to use Next.js. However, when a use clicks a link, it will take 1-2 seconds for the server to get the data from firebase. This is a bad user experience, because the user has no way of knowing that the page is actually loading.
How would you send an "App shell" (Page with no data), before getting the data from
getServerSideProps
? -
Environment variables disappear when Firebase hosted (React) site is accessed
Sometimes, when I visit my web app, I get the following error in the console:
a: null code: "auth/invalid-api-key" message: "Your API key is invalid, please check you have copied it correctly."
Other times I don't have a problem and the app works fine. The problem seems to be to do with my environment variables, saved in my .env file. I've console.log'd them and most of them appear to have disappear whenever I get the above error. They are present at other times.
I'm running a hosted (React) Firebase app and using the Firebase Auth on a back-end node.js server hosted on Heroku.
-
Open default contacts app from my app in Flutter
I am not asking to retrieve contacts data in my app, all I want is the user to be navigated to the default contacts app in the phone.
I have looked at many questions but all of them are about retrieving contacts data.
Questions I have looked at:
-
How can I access flutter app context when I call CallbackHandler from background?
I built a background service to invoke a flutter function when the app in the background using
var callbackHandle = PluginUtilities.getCallbackHandle(backgroundHandler); channel.invokeMethod('startService', callbackHandle.toRawHandle());
now I want to view an alert dialog when I call this callback function, but I can't access the context, how can I view a dialog or navigate from flutter background function?
-
My flutter project was working fine but now it's showing error while running it
My Flutter project was working perfectly fine. I had implemented google map and I wanted to draw routes between source and destination points on flutter google map. The map was showing too.
But now when I am running my code I am getting error. Please help me solving this. I can't even run my project now.
The error I am getting:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':hexcolor'. > Failed to notify project evaluation listener. > java.lang.AbstractMethodError (no error message) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --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 13s Exception: Gradle task assembleDebug failed with exit code 1
my pubspec.yaml:
name: thehelpdesk description: A new Flutter application. # The following line prevents the package from being accidentally published to # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 environment: sdk: ">=2.7.0 <3.0.0" dependencies: flutter: sdk: flutter introduction_screen: ^1.0.7 shared_preferences: ^0.5.12+4 hexcolor: ^1.0.6 curved_navigation_bar: ^0.3.4 email_validator: '^1.0.5' validate: ^1.7.0 dio: 3.0.10 pin_code_fields: ^5.0.1 geolocator: ^6.1.14 google_maps_flutter: 0.5.21+17 google_map_polyline: permission: ^0.1.7 fluttertoast: ^3.1.3 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 firebase_messaging: ^7.0.3 sqflite: ^1.3.2+2 path_provider: ^1.6.24 dev_dependencies: flutter_test: sdk: flutter # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: assets: - assets/images/sp_screen.png - assets/images/reg_logo.png - assets/images/email@_icon.png - assets/images/mobile_icon.png - assets/images/arrow_icon.png - assets/images/Invoice.png - assets/images/cake.png - assets/images/calender.png - assets/images/Reminder.png # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: fonts: - family: Poppins fonts: - asset: fonts/Poppins-Medium.ttf - asset: fonts/Poppins-Regular.ttf - asset: fonts/Poppins-SemiBold.ttf - family: Roboto fonts: - asset: fonts/Roboto-Medium.ttf # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages
-
CORS error when using the browser console to send request that succeeded (Firefox, Chrome, Brave)
I have a form on my website which works properly. When I press f12 to open the console, I can see that the request is being made successfully with a 200 status. I can also right-click on the request and edit/resend it, and it also works (shown below):
However, when I copy the request as fetch in Chrome (or "use as fetch in console" in Firefox), I get CORS errors.
I get CORS errors in every browser that I use. Is there something that I need to add to my fetch request in order to make it work? Why is it that I can right-click on the network tab and resend it, but it won't work when I use as fetch in the console?
-
How can I fix : "Access to simcast.com was denied"?
I am using Chrome Browser. I have disabled "SameSite by default cookies". But still, I am not able to access simcast.com. Please suggest a working way to access this website.
-
Chrome sending multiple requests for site with link rel="next"
In my node.js snowplow logs I'm seeing multiple pageView-events being fired after just opening one URL in Chrome.
The page I am loading is part of a pagination, so it has a
<link rel="next" href=".../2">
tag. In my logs, there are then two events, one for the URL I was loading and one for the URL of the "next" page.This issue only persists with Chrome. Calling the same URL with Safari or just by curl results in only one event being fired.
Is it possible that Chrome tries to be smarter and preloads/requests the "next" page behind the scenes?
Any help or idea on this is highly appreciated!
-
Cannot see published data and image on a site, what is missing?
So I have a problem with pulling data from firebase to template. I want to see my published data, I can see them on my console but not on a template. I think maybe it's the problem with matching the js objects in my HTML code. What should I change?
This is my HTML code:
<div class="row"> <div v-for="info in info" :key="info" class="col-lg-4 col-md-4 col-sm-4 col-xs-12" cards-aos="fade-right"> <div class="blog column text-center"> <div class="card-header"> {{info.imeLokacije}} </div> <div class="card-body p-0"> <img class="card-img-top" :src="info.url" /> </div> </div> </div> </div> </div> </section>
I have already imported store, storage, firebase, database. Also db collection created for posts. And this is my javascript:
data: function() { return { cards: [], email: "", lozinka: "", novoImeLokacije: "", noviKontakt: "", novaCijena: "", noviOpisSlike: "", slikaReference: null, postedFromNow2: "Ok from data", }; }, mounted() { this.noveObjave(); }, methods: { noveObjave() { console.log("firebase dohvat"); let cards = []; db.collection("objave") .get() .then((query) => { this.cards = []; query.forEach((doc) => { const data = doc.data(); console.log(data); this.cards.push({ id: doc.id, time: data.posted_at, Url: data.url, imeLokacije: data.imeLokacije, kontakt: data.kontakt, stanje: data.stanje, novaCijena: data.iznosCijene, opisSlike: data.opisSlike, }) }); }); }, objave() { const imeLokacije = this.novoImeLokacije; const kontakt = this.noviKontakt; const iznosCijene = this.novaCijena; const opisSlike = this.noviOpisSlike; const stanje = this.stanje = document.getElementById("stanje").value; const url = this.url; this.slikaReference.generateBlob(blobData => { console.log(blobData); let nazivSlike = "objave/" + store.currentUser + "/" + Date.now() + ".png"; storage .ref(nazivSlike) .put(blobData) .then(result => { result.ref.getDownloadURL().then((url) => { console.log("Javni link", url);
-
Cloud Firestore and RecyclerView. On saving data in the cloud firestore the data is not getting updated in the adapter in realtime
I am using Cloud Firestore and RecyclerView.Adapter for displaying my data in the activity. When I am saving my data the changes are not getting reflected in the adapter in the real-time. It is working fine when I an restarting the app or reloading the activity the newly saved entity is visible then.
private var allEntities: List<EntityModel> = ArrayList() private val entityAdapter: EntityAdapter = EntityAdapter(this,allEntities) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // set layout manager for adapter val layoutManager = LinearLayoutManager(this) layoutManager.orientation = LinearLayoutManager.VERTICAL entityViewRecycler.layoutManager = layoutManager entityViewRecycler.adapter = entityAdapter getAllEntities(); val fab: View = findViewById(R.id.fab) fab.setOnClickListener { _ -> // ... getting data as input to save the entity // save to firebase cloud firestore FirestoreClass().addEntity(this, entity); } mDialogView.cancel.setOnClickListener { mAlertDialog.dismiss() } } } // getting the entities and setting notifyDataSetChanged() to the adapter private fun getAllEntities() { FirestoreClass().getAllEntities().addOnCompleteListener{ if(it.isSuccessful){ this.hideProgressDialog() allEntities = it.result!!.toObjects(EntityModel::class.java) entityAdapter.entities = allEntities // applying notifyDataSetChanged() to the adapter entityAdapter.notifyDataSetChanged() }else{ this.hideProgressDialog() Log.e("fail get entities", "Failed to get all the entities for the user ") } } } // When my entity is getting added successfully I am calling a function to show the toast and also calling notifyDataSetChanged() on the adapter fun entityAddingSuccessful() { hideProgressDialog() entityAdapter.notifyDataSetChanged() showToast("Entity Added Successfully"); } // Also setting notifyDataSetChanged() in the onStart method override fun onStart() { super.onStart() entityAdapter.notifyDataSetChanged(); }
Here is my AddEntity method
fun addEntity(activity: MainActivity, entity: EntityModel){ val entityId : String = mFireStore.collection(Constants.USERS).document(getCurrentUserId()).collection(Constants.ENTITIES).document().id entity.entityId = entityId mFireStore.collection(Constants.USERS) .document(getCurrentUserId()) .collection(Constants.ENTITIES) .document(entityId) .set(entity) .addOnSuccessListener { activity.entityAddingSuccessful() } .addOnFailureListener{e -> activity.hideProgressDialog() Log.e("Adding Entity Failed", "addEntity: ", e) } }
Here is my EntityAdapter class
class EntityAdapter(val context: Context?,var entities: List<EntityModel>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { (holder as viewHolder).bind(entities[position], position); } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EntityAdapter.viewHolder { val view = LayoutInflater.from(parent.context).inflate(R.layout.entity_row, parent, false) return viewHolder(view); } override fun getItemCount(): Int { return entities.size; } inner class viewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){ fun bind(entity: EntityModel?, position: Int){ itemView.name.text = entity!!.name itemView.amount.text = entity.amount.toString() } } }
Let me know what am I missing here? Thanks in advance for your help.
-
Cannot read property 'forEach' of undefined VueJS Firebase
I use the framework VueJS and the NoSQL Database Firebase. Here I want to display the products' data. And particulary the images of the products stored in the Cloud Firestore in Firebase.
This is the HTML code :
<div class="col-md-4"v-for="(product, index) in products" :key="index"> <div class="card product-item"> <carousel :perPage="1"> <slide v-for="(image, index) in product.images" :key="index"> <img :src="image" class="card-img-top" alt="..." width="250px"> </slide> </carousel> <div class="card-body"> <div class="d-flex justify-content-between"> <h5 class="card-title">{{ product.name }}</h5> <h5 class="card-prices">{{ product.price }} €</h5> </div> <button class="btn btn-primary mx-3 butn" > Add to cart </button> </div> </div> </div>
and the js script :
<script> import {db} from '../../firebase'; export default { name: "Productslist", props: { msg: String }, data(){ return { products: [], } }, firestore() { return { products: db.collection("products") } } }, }; </script> It displays the products data like the name and the price but not the images. I have a Cannot read property 'forEach' of undefined.