Skip to content

Instantly share code, notes, and snippets.

@mulieriq
Last active September 18, 2020 14:37
Show Gist options
  • Save mulieriq/865d01b85271a254fa6eb24509e3d5d6 to your computer and use it in GitHub Desktop.
Save mulieriq/865d01b85271a254fa6eb24509e3d5d6 to your computer and use it in GitHub Desktop.
data.dart
Future<void> updateData(data) async {
print('function add data called');
Firestore.instance
.collection('users')
.document(widget.uid)
.updateData(data)
.then((result) {
print("data added ..................................... ");
// print(result);
}).catchError((e) {
print(e);
});
}
addData({
'status': status,
'userPhoneNumber':
"$countrycode$phonenumber",
'userId': widget.uid,
'userEmail': widget.email,
'userImage': imgUrlDownload,
'role': widget.role,
'isleader': widget.role
.toString()
.toLowerCase()
.trim() !=
'member'
? true
: false,
'userBio': {
},
'verified': {
'verification': true,
'message': '',
'logout': false
}
}).then((result) async {
print('profile updated');
setState(() {
upload = false;
});
updataData({
'userBio': {
'family': widget.family,
'role':
widget.role.toLowerCase(),
'year': widget.family ==
"Associates"
? "Cleared School"
: year,
'collage': widget.family ==
"Associates"
? "Cleared School"
: collage,
},
'verified': {
'verification': true,
'message': '',
'logout': false
}
}).then((result) async {
print('profile updated');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment