import 'dart:convert';

import 'package:shared_preferences/shared_preferences.dart';

import '../../models/user_model.dart';

class AuthProvider {
  // get the user model from shared preferences
  static Future<UserModel?> getUserModel() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    String? userModelString = prefs.getString("userModel");
    if (userModelString != null) {
      Map<String, dynamic> userModelJson = jsonDecode(userModelString);
      return UserModel.fromJson(userModelJson);
    }
    return null;
  }
}
