Commit db4da9bd authored by Indika NK's avatar Indika NK

IGUDER_PHASE03

Data can be retrived using firebase firestore changes added for sending selfcare details
parent c0f97a17
import 'dart:collection';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_sms/flutter_sms.dart';
class MessageSender {
List<String> recipients= ["+94776957629"];
Map<String,String> myDetails = {
"Name" : "Indika Nuwan",
"Address" : "02 nd post ,Mawanella",
"HomePhone" : "03522444555",
"message" : "This Patient Need Imediate assistance"
};
String Name;
String phoneNumber;
String Address;
String HomePhone;
//
// Map<String,String> myDetails = {
// "Name" : "Indika Nuwan",
// "Address" : "02 nd post ,Mawanella",
// "HomePhone" : "03522444555",
// "message" : "This Patient Need Imediate assistance"
// };
// MessageSender(this.recipients, this.message);
void SENDSMS () async{
print(myDetails.toString());
String result = await sendSMS(message: myDetails.toString(), recipients: recipients).catchError((onError)=>print(onError));
print("result");
}
print("Executing get data");
final CollectionReference userlist =
FirebaseFirestore.instance.collection("users");
void SetData(){
userlist.get().then((datasnapshot){
print("Executing get data ...");
FirebaseFirestore.instance.collection("users").get().then((QuerySnapshot snapshot){
snapshot.docs.forEach((doc) async {
print(doc["Name"]);
print(doc["Address"]);
print(doc["Home phone"]);
print(doc["mobile"]);
Map<String,String> UserDetails = {
"Name" : doc["Name"],
"Address" : doc["Address"],
"HomePhone" : doc["Home phone"],
"message" : "This Patient Need Imediate assistance"
};
}
print("UserDetails : "+UserDetails.toString());
String result = await sendSMS(message: UserDetails.toString(), recipients: recipients).catchError((onError)=>print(onError));
print("result");
});
});
});
}
}
......@@ -124,6 +124,7 @@ flutter:
- assets/
- lib/assets/images/wear.gif
- lib/assets/images/hospital.gif
- lib/assets/images/lab.gif
# To add assets to your application, add an assets section, like this:
# assets:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment