import 'package:flutter/material.dart'; import 'package:rijig_mobile/model/userpin_model.dart'; class PinViewModel extends ChangeNotifier { final PinModel _pinModel = PinModel(); bool? pinExists; Future checkPinStatus(String userId) async { try { var response = await _pinModel.checkPinStatus(userId); if (response?.status == 200) { pinExists = true; } else { pinExists = false; } notifyListeners(); } catch (e) { debugPrint('Error checking pin status: $e'); pinExists = false; notifyListeners(); } } Future createPin(String pin) async { try { var response = await _pinModel.setPin(pin); if (response?.status == 201) { pinExists = true; } else { pinExists = false; } notifyListeners(); } catch (e) { debugPrint('Error creating pin: $e'); pinExists = false; notifyListeners(); } } Future verifyPin(String pin) async { try { var response = await _pinModel.verifyPin(pin); if (response?.status == 200) { pinExists = true; } else { pinExists = false; } notifyListeners(); } catch (e) { debugPrint('Error verifying pin: $e'); pinExists = false; notifyListeners(); } } }