logout method
- BuildContext context
Implementation
Future<void> logout(BuildContext context) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove('userData');
await prefs.remove('token');
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => HomeScreen(),
),
);
}