14 lines
362 B
Dart
14 lines
362 B
Dart
import 'package:didvan/providers/core_provider.dart';
|
|
import 'package:hive/hive.dart';
|
|
|
|
class UserProvider extends CoreProvier {
|
|
Future<String?> setAndGetToken({String? token}) async {
|
|
final box = await Hive.openBox('autherization');
|
|
if (token != null) {
|
|
await box.put('token', token);
|
|
} else {
|
|
return box.toMap()['token'];
|
|
}
|
|
}
|
|
}
|