zubairehman / flutter_boilerplate_project

A boilerplate project created in flutter using MobX and Provider.
http://zubairehman.surge.sh/
MIT License
2.29k stars 911 forks source link

Error with mobx when run build_runner #20

Closed analistacarlosh closed 5 years ago

analistacarlosh commented 5 years ago

Hello, thank you so much for the boilerplate-project,

I'm trying to install the project and I'm getting this error below: Have you got this error? Thank you for your help.

Error:

flutter packages pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 511ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 9.0s

[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:11:7: Error: Found unsupported uses of 'T' in supertype 'NotificationHandlers'.class Interceptors<T>      ^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/listenable.dart:10:7: Error: Found unsupported uses of 'TNotification' in supertype 'NotificationHandlers'.class Listeners<TNotification>      ^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core/observable.dart:49:20: Error: The getter 'hasHandlers' isn't defined for the class 'Listeners<ChangeNotification<T>>'. - 'Listeners' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart'). - 'ChangeNotification' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart').Try correcting the name to the name of an existing getter, or defining a getter or field named 'hasHandlers'.    if (_listeners.hasHandlers) {                   ^^^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core/observable.dart:63:23: Error: The getter 'hasHandlers' isn't defined for the class 'Interceptors<T>'. - 'Interceptors' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart').Try correcting the name to the name of an existing getter, or defining a getter or field named 'hasHandlers'.    if (_interceptors.hasHandlers) {                      ^^^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:14:48: Error: Too many positional arguments: 0 allowed, but 1 found.Try removing the extra positional arguments.  Interceptors(ReactiveContext context) : super(context);                                               ^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:17:52: Error: Method not found: 'add'.  Dispose intercept(Interceptor<T> interceptor) => add(interceptor);                                                   ^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:17:52: Error: The method 'add' isn't defined for the class 'Interceptors<T>'. - 'Interceptors' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart').Try correcting the name to the name of an existing method, or defining a method named 'add'.  Dispose intercept(Interceptor<T> interceptor) => add(interceptor);                                                   ^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:20:10: Error: Method not found: '_canHandle'.    if (!_canHandle(change)) {         ^^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:26:33: Error: Getter not found: '_handlers'.      for (final interceptor in _handlers.toList(growable: false)) {                                ^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:24:12: Error: Getter not found: '_context'.    return _context.untracked(() {           ^^^^^^^^
pub finished with exit code 78
zubairehman commented 5 years ago

@analistacarlosh i have updated the mobX version, please try now and let me know if problem still persists

analistacarlosh commented 5 years ago

Hello @zubairehman, I will check here now.

Thank you so much.

engmsaleh commented 4 years ago

I think that I'm getting the same issue


lib/di/components/app_component.dart:7:8: Error: Error when reading 'lib/di/components/app_component.inject.dart': No such file or directory
import 'app_component.inject.dart' as g;
       ^
lib/di/components/app_component.dart:20:20: Error: Getter not found: 'AppComponent$Injector'.
    return await g.AppComponent$Injector.create(
                   ^^^^^^^^^^^^^^^^^^^^^
lib/ui/home/home.dart:65:11: Error: No named parameter with the name 'name'.
          name: 'error',
          ^^^^
/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_mobx-0.3.4+2/lib/src/observer.dart:16:3: Context: Found this candidate, but the
arguments don't match.
  Observer({Key key, @required this.builder})
  ^^^^^^^^
lib/stores/post/post_store.g.dart:23:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$postsListAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/post/post_store.g.dart:38:27: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
    _$successAtom.context.checkIfStateModificationsAreAllowed(_$successAtom);
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/post/post_store.g.dart:53:27: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
    _$loadingAtom.context.checkIfStateModificationsAreAllowed(_$loadingAtom);
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:40:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$postsListAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:56:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$userEmailAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:71:28: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
    _$passwordAtom.context.checkIfStateModificationsAreAllowed(_$passwordAtom);
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:87:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$confirmPasswordAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:102:27: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
    _$successAtom.context.checkIfStateModificationsAreAllowed(_$successAtom);
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:117:27: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
    _$loadingAtom.context.checkIfStateModificationsAreAllowed(_$loadingAtom);
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:246:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$userEmailAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:261:28: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
    _$passwordAtom.context.checkIfStateModificationsAreAllowed(_$passwordAtom);
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/form/form_store.g.dart:277:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$confirmPasswordAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/error/error_store.g.dart:23:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$errorMessageAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/stores/error/error_store.g.dart:39:10: Error: The method 'checkIfStateModificationsAreAllowed' isn't defined for the class 'ReactiveContext'.
 - 'ReactiveContext' is from 'package:mobx/src/core.dart' ('/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.3.10/lib/src/core.dart').
Try correcting the name to the name of an existing method, or defining a method named 'checkIfStateModificationsAreAllowed'.
        .checkIfStateModificationsAreAllowed(_$showErrorAtom);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
Failed to build bundle.
Error launching application on iPhone 11 Pro Max.```

Any advice?
zubairehman commented 4 years ago

Try upgrading flutter, make sure you are using v1.12 and dart 2.7

Let me know if issue still persists.

engmsaleh commented 4 years ago

I'm already using: Flutter 1.12.13+hotfix.5 Dart SDK 2.7

zubairehman commented 4 years ago

I just cloned the project and its working perfectly fine for me. Please make sure you followed the steps mentioned here to clone and build the project: https://github.com/zubairehman/flutter-boilerplate-project#how-to-use

engmsaleh commented 4 years ago

@zubairehman It worked, it was my fault thanks a lot

zubairehman commented 4 years ago

Glad to hear it worked :)