I am working on a flutter app using firebase firestore and firebase functions.I am getting this exception again and again -
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: [firebase_functions/internal] INTERNAL
E/flutter (15454): #0 catchPlatformException (package:cloud_functions_platform_interface/src/method_channel/utils/exception.dart:19:3)
I have tried to resolve this exception since last few hours but unable to make any progress. This the code for my function from index.js file.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.addUser = functions.https.onCall(async (data) => {
await admin.firestore().collection("collection_name").add({
name: "my_name",
email: "my_email"
}
);
});
This is my dart code for flutter app.
MyButton(
onPressed: () async {
HttpsCallable a =
FirebaseFunctions.instance.httpsCallable("addUser");
final x = await a();
print(x.data);
},
),
Thanks in advance !