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 'dart:collection';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_sms/flutter_sms.dart'; import 'package:flutter_sms/flutter_sms.dart';
class MessageSender { class MessageSender {
List<String> recipients= ["+94776957629"]; List<String> recipients= ["+94776957629"];
Map<String,String> myDetails = { String Name;
"Name" : "Indika Nuwan", String phoneNumber;
"Address" : "02 nd post ,Mawanella", String Address;
"HomePhone" : "03522444555", String HomePhone;
"message" : "This Patient Need Imediate assistance"
};
//
// 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); // MessageSender(this.recipients, this.message);
void SENDSMS () async{ void SENDSMS () async{
print(myDetails.toString()); print("Executing get data");
String result = await sendSMS(message: myDetails.toString(), recipients: recipients).catchError((onError)=>print(onError)); final CollectionReference userlist =
print("result"); 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: ...@@ -124,6 +124,7 @@ flutter:
- assets/ - assets/
- lib/assets/images/wear.gif - lib/assets/images/wear.gif
- lib/assets/images/hospital.gif - lib/assets/images/hospital.gif
- lib/assets/images/lab.gif
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # 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