save login works
This commit is contained in:
parent
4c036b8bf2
commit
c288f257c5
7 changed files with 51 additions and 16 deletions
|
@ -1,7 +1,17 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:local_spend/common/apifunctions/request_logout_api.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
logout(context) {
|
||||
requestLogoutAPI(context);
|
||||
Navigator.of(context).pushReplacementNamed('/LoginPage');
|
||||
_clearLoginDetails();
|
||||
}
|
||||
|
||||
_clearLoginDetails() async {
|
||||
SharedPreferences preferences = await SharedPreferences.getInstance();
|
||||
|
||||
preferences.setString('username', "");
|
||||
preferences.setString('password', "");
|
||||
print("details cleared");
|
||||
}
|
Reference in a new issue