This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
LocalSpend-Tracker/lib/common/functions/logout.dart
Felix 55310068ea Code is B-E-A-U-TIFUL! All complies to standards.
Complies to flutter/dart 'pedantic' coding standards (their name, not mine)
2019-08-21 14:53:52 +01:00

17 lines
547 B
Dart

import 'package:flutter/material.dart';
import 'package:local_spend/common/apifunctions/request_logout_api.dart';
import 'package:shared_preferences/shared_preferences.dart';
void logout(context) {
requestLogoutAPI(context);
Navigator.of(context).pushReplacementNamed('/LoginPage');
_clearLoginDetails();
}
void _clearLoginDetails() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('username', "");
await preferences.setString('password', "");
print("details cleared");
}