I am trying to log in with the help of API and after login wants to see dashboard. but I am getting a message {status: error, message: Seller Not Logged In} I tried creating a session of login but it didn't work.
Login Page
postMethod() async {
var api = Uri.parse("https://www.nearxt.com/index.php?route=api/userlogin");
Map mapeddate ={
'email':_email.text,
'password':_password.text,
};
final response= await post(api,body: mapeddate);
if(response.statusCode==200)
{
await FlutterSession().set('token',_email.text);
print("Session Created");
}
var res = json.decode(response.body);
print(res);
}
it gives the output: Session Created {cust: Login Success, error_warning: , success: }
after this, on homepage, I am trying to access the products after the login
Future fetchSellerProduct() async {
FlutterSession().get('token');
var url = await http.post(Uri.parse(
"https://www.nearxt.com/index.php?route=api/purpletree_multivendor/api/sellerproduct"));
if(url.statusCode==200)
{
print(url.statusCode);
}
setState(() {
map = json.decode(url.body);
print(map);
});
}
Output: {status: error, message: Seller Not Logged In}