NoSuchMethodError: The getter ‘element’ was called on null. Receiver: null Tried calling: element

Estou utilizando o MobX no seguinte cenário:

@observable
bool _viewVisibleInitial = false;

@action
void showStopAndPause() {
_viewVisibleStop = true;
_viewVisibleInitial = false;
}

  • Sendo que ele atualmente está acusando esse erro:
    [SEVERE] mobx_codegen:mobx_generator on lib/business rules/manipulateTimerVisibility.dart:

NoSuchMethodError: The getter ‘element’ was called on null.
Receiver: null
Tried calling: element
[INFO] 2.7s elapsed, 2/7 actions completed.
[INFO] 5.5s elapsed, 2/7 actions completed.
[INFO] 9.9s elapsed, 3/7 actions completed.
[INFO] Running build completed, took 10.0s

  • Tentativas de resolução:
    ** Apagar o .dart-tool:
    flutter clean
    flutter pub get
    ** Atualizar o pub:
    flutter pub upgrade

  • Comando que estou executando para tentar criar o .g.dart:
    flutter packages pub run build_runner build –delete-conflicting-outputs

Desde já, eu agradeço.

Author: Fantashit

1 thought on “NoSuchMethodError: The getter ‘element’ was called on null. Receiver: null Tried calling: element

  1. Pessoal encontrei a solução, realmente era só problema de sintaxe em:

    • part ‘manipulate_timer_visibility.g.dart’;
      Estava como:
    • part (‘manipulate_timer_visibility.g.dart’);

    Cuidado aos detalhes é sempre importante kkk

Comments are closed.