Open HosamHasanRamadan opened 1 month ago
Reproducable code
import 'package:mobx/mobx.dart'; part 'view_model.g.dart'; class ViewModel = _ViewModel with _$ViewModel; abstract class _ViewModel with Store { @observable List<int> list = []; } extension on int {}
Error
[INFO] Starting Build [INFO] Updating asset graph completed, took 1ms [SEVERE] mobx_codegen:mobx_generator on lib/view_model.dart: Null check operator used on a null value package:mobx_codegen/src/type_names.dart 32:46 LibraryScopedNameFinder.namesByElement package:mobx_codegen/src/type_names.dart 137:12 LibraryScopedNameFinder._getNamedElementTypeName package:mobx_codegen/src/type_names.dart 94:12 LibraryScopedNameFinder._getDartTypeName dart:_internal ListIterable.toList package:mobx_codegen/src/type_names.dart 133:56 LibraryScopedNameFinder._getNamedElementTypeName package:mobx_codegen/src/type_names.dart 94:12 LibraryScopedNameFinder._getDartTypeName package:mobx_codegen/src/type_names.dart 48:7 LibraryScopedNameFinder.findVariableTypeName package:mobx_codegen/src/store_class_visitor.dart 100:28 StoreClassVisitor.visitFieldElement package:analyzer/src/dart/element/element.dart 3110:54 FieldElementImpl.accept package:analyzer/src/dart/element/element.dart 2491:13 ElementImpl.visitChildren package:mobx_codegen/src/mobx_codegen_base.dart 85:9 StoreGenerator._generateCodeFromTemplate package:mobx_codegen/src/mobx_codegen_base.dart 67:13 StoreGenerator._generateCodeForMixinStore dart:core Iterable.toSet package:mobx_codegen/src/mobx_codegen_base.dart 26:68 StoreGenerator.generate package:source_gen/src/builder.dart 342:33 _generate dart:async Stream.toList.<fn> package:source_gen/src/builder.dart 107:9 _Builder._generateForLibrary package:source_gen/src/builder.dart 99:5 _Builder.build [INFO] Running build completed, took 47ms [INFO] Caching finalized dependency graph completed, took 23ms [SEVERE] Failed after 74ms
Packages
build_runner: ^2.4.11 mobx_codegen: ^2.6.1 flutter_mobx: ^2.2.1+1 mobx: ^2.3.3+2
Flutter version: 3.22.2 if I add name to extension, it will work fine
3.22.2
extension _intX on int {}
Omg. This is such a life saver. I tried all my luck but couldn't get through the build runner. Thanks
Reproducable code
Error
Packages
Flutter version:
3.22.2
if I add name to extension, it will work fine