I want to get the data from database. I have 2 Apis 1: to get records information like name, address, company etc… another one api 2: for getting ProfilePhoto. I am getting output from first api but not able to get profilePhoto Api. So how can I call both Apis in a single function? function is
Future<DataDetails> getData1() async {
var id = 34;
final response1 = await http.get(Uri.parse("Api Url"));
if(response1.statusCode == 200) {
var temp = DataDetails.fromJson(jsonDecode(response1.body));
print(temp);
return temp;
}
return DataDetails.fromJson(jsonDecode(response1.body)) ;
}
FutureBuilder(
future: getData(),
builder: (context, snapshot) {
return Screenshot(
controller: _ssController,
child: GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => OntapView()));
},
child: Stack(
children: [
Container(
padding: const EdgeInsets.all(10),
width: 350,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
// color: Colors.amber[100]
color: const Color(0xffccf7ff)
),
child: Column(
children: [
Container(
padding: EdgeInsets.all(10),
child: Row(
children: [
Container(
height: 15,
width: 200,
child: Text('${snapshot.data!.cardName} ',
style: TextStyle(fontWeight: FontWeight.bold),),
),
SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
CircleAvatar(
radius: 45,
backgroundColor: Colors.grey,
backgroundImage: FileImage(File('${snapshot.data!.profilePhotoPath}')),
),
const SizedBox(width: 10),
Container(
padding: const EdgeInsets.only(left: 20,top: 10),
width: 130,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('${snapshot.data!.name} ',
style: const TextStyle(fontSize: 22,fontWeight: FontWeight.bold),),
const SizedBox(height: 5),
Container(
child: Text('${snapshot.data!.address}',
style: const TextStyle(fontSize: 12),),
)
],
)
),
I am new to flutter. If possible please share example code.