updateUserRecord method
This method updates an existing user record in Firestore. @param userId The ID of the user whose record is to be updated. @param data A map containing the fields to be updated in the user record. @throws String if the user record does not exist. @throws String if there is an error updating the user record.
Implementation
Future<void> updateUserRecord(String userId,
Map<String, dynamic> data) async {
try {
await _db.collection("users").doc(userId).set(data, SetOptions(merge: true));
} on FirebaseAuthException catch (e) {
final result = TExceptions.fromCode(e.code);
throw result.message;
} on FirebaseException catch (e) {
throw e.message.toString();
} catch (_) {
throw 'Something went wrong. Please Try Again';
}
}