请帮帮我。我不知道这段代码有什么问题: 试图让用户密码存储在首选项中,但出现错误,这是我尝试过的代码
'package:shared_preferences/shared_preferences.dart';
class AuthenticationPinBloc extends Bloc<AuthenticationPinEvent, AuthenticationPinState> {
final PINRepository pinRepository;
isUserloggedIn() async {
// Obtain shared preferences.
final prefs = await SharedPreferences.getInstance();
var passcode = prefs.getString('status');
}
AuthenticationPinBloc({required this.pinRepository}) : super(const AuthenticationPinState(pinStatus: AuthenticationPINStatus.enterPIN)) {
on<AuthenticationPinAddEvent>((event, emit) async {
String pin = "${state.pin}${event.pinNum}";
if(pin.length < 6){
emit(AuthenticationPinState(pin: pin, pinStatus: AuthenticationPINStatus.enterPIN));
}
// get password from SharedPreferences
else if (pin == passcode){
print(passcode);
emit(AuthenticationPinState(pin: pin, pinStatus: AuthenticationPINStatus.equals));
In the line (pin == passcode) I get an error:
print passcode also has error am new to Flutter
will be very glad to get help