Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null check operator used on a null value #864

Closed
ezrac0des opened this issue Feb 28, 2024 · 0 comments
Closed

Null check operator used on a null value #864

ezrac0des opened this issue Feb 28, 2024 · 0 comments
Assignees
Labels
bug Something isn't working needs triage

Comments

@ezrac0des
Copy link

This used to work completely great. However, when I opened my app today I started getting the error below:

======== Exception caught by widgets library =======================================================
The following _TypeError was thrown building Consumer<UserModal>(dirty, dependencies: [MediaQuery, _InheritedProviderScope<UserModal?>]):
Null check operator used on a null value

The relevant error-causing widget was: 
  Consumer<UserModal> Consumer:

The error points to the return Consumer<UserModal>(builder: (context, modal, child) { line

  @override
  Widget build(BuildContext context) {
    Responsive responsive = Responsive(context);
    GlobalKey<FormState> basicFormKey = GlobalKey<FormState>();
    return Consumer<UserModal>(builder: (context, modal, child) {
      return SafeArea(
        child: SingleChildScrollView(
          child: Column(
          ),
        ),
      );
    });
  }

And my UserModal looks as below

import 'package:flutter/foundation.dart';

class UserModal extends ChangeNotifier {
  String? name;
  String? lastName;
  String? email;
  String? password;
  String? phoneNumber;
  String? career;
  String? country;
  String? birthdate;
  String? sex;

  int activeIndex = 0;
  int totalIndex = 2;

  changeStep(int index) {
    activeIndex = index;
    notifyListeners();
  }
}

I was using 6.0.2. I upgraded it to 6.1.2. Yet the issue is still there. What should I do?

@ezrac0des ezrac0des added bug Something isn't working needs triage labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants