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

NoSuchMethodError: The getter 'definingUnit' was called on null. #738

Closed
FabioPagano opened this issue Nov 2, 2020 · 27 comments
Closed

Comments

@FabioPagano
Copy link

FabioPagano commented Nov 2, 2020

Using flutter 1.22.3, when I run "flutter pub run build_runner build" I receive the following:

[SEVERE] json_serializable:json_serializable on lib/arguments/customers_screen_arguments.dart:

NoSuchMethodError: The getter 'definingUnit' was called on null.
Receiver: null
Tried calling: definingUnit
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      LinkedElementFactory.isLibraryUri (package:analyzer/src/summary2/linked_element_factory.dart:133:28)
#2      LibraryContext.isLibraryUri (package:analyzer/src/dart/analysis/library_context.dart:97:27)
#3      LibraryAnalyzer._isLibrarySource (package:analyzer/src/dart/analysis/library_analyzer.dart:522:25)
#4      LibraryAnalyzer._resolveDirectives (package:analyzer/src/dart/analysis/library_analyzer.dart:562:36)
#5      LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:136:5)
#6      LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:107:12)
#7      AnalysisDriver._computeAnalysisResult2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1317:63)
#8      PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:32:15)
#9      AnalysisDriver._computeAnalysisResult2 (package:analyzer/src/dart/analysis/driver.dart:1294:20)
#10     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1247:14)
#11     _rootRun (dart:async/zone.dart:1190:13)
#12     _CustomZone.run (dart:async/zone.dart:1093:19)
#13     _runZoned (dart:async/zone.dart:1630:10)
#14     runZoned (dart:async/zone.dart:1550:10)
#15     NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#16     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1246:40)
#17     AnalysisDriver._computeErrors (package:analyzer/src/dart/analysis/driver.dart:1372:41)
#18     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:979:20)
#19     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2013:24)
<asynchronous suspension>
#20     AnalysisDriverScheduler.start (package:analyzer/src/dart/analysis/driver.dart:1936:5)
#21     analysisDriver (package:build_resolvers/src/analysis_driver.dart:62:13)
#22     AnalyzerResolvers._ensureInitialized.<anonymous closure> (package:build_resolvers/src/resolver.dart:306:26)
<asynchronous suspension>
#23     AnalyzerResolvers._ensureInitialized.<anonymous closure> (package:build_resolvers/src/resolver.dart)
#24     AnalyzerResolvers._ensureInitialized (package:build_resolvers/src/resolver.dart:309:6)
#25     AnalyzerResolvers.get (package:build_resolvers/src/resolver.dart:314:11)
#26     PerformanceTrackingResolvers.get.<anonymous closure> (package:build_runner_core/src/performance_tracking/performance_tracking_resolvers.dart:19:58)
#27     _NoOpBuilderActionTracker.trackStage (package:build_runner_core/src/generate/performance_tracker.dart:302:15)
#28     PerformanceTrackingResolvers.get (package:build_runner_core/src/performance_tracking/performance_tracking_resolvers.dart:19:16)
#29     BuildStepImpl.resolver (package:build/src/builder/build_step_impl.dart:74:54)
#30     _Builder.build (package:source_gen/src/builder.dart:72:32)
#31     runBuilder.buildForInput (package:build/src/generate/run_builder.dart:55:21)
#32     MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
#33     ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
#34     Future.wait (dart:async/future.dart:406:26)
#35     runBuilder.<anonymous closure> (package:build/src/generate/run_builder.dart:61:36)
#36     _rootRun (dart:async/zone.dart:1190:13)
#37     _CustomZone.run (dart:async/zone.dart:1093:19)
#38     _runZoned (dart:async/zone.dart:1630:10)
#39     runZonedGuarded (dart:async/zone.dart:1618:12)
#40     runZoned (dart:async/zone.dart:1547:12)
#41     scopeLogAsync (package:build/src/builder/logging.dart:26:3)
#42     runBuilder (package:build/src/generate/run_builder.dart:61:9)
#43     _SingleBuild._runForInput.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:485:19)
#44     _NoOpBuilderActionTracker.trackStage (package:build_runner_core/src/generate/performance_tracker.dart:302:15)
#45     _SingleBuild._runForInput.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:483:23)
<asynchronous suspension>
#46     _SingleBuild._runForInput.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart)
#47     NoOpTimeTracker.track (package:timing/src/timing.dart:222:44)
#48     _SingleBuild._runForInput.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:440:22)
#49     Pool.withResource (package:pool/pool.dart:127:28)
<asynchronous suspension>
#50     _SingleBuild._runForInput (package:build_runner_core/src/generate/build_impl.dart:436:17)
#51     _SingleBuild._runBuilder.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:374:38)
#52     MappedIterator.moveNext (dart:_internal/iterable.dart:392:20)
#53     Future.wait (dart:async/future.dart:406:26)
#54     _SingleBuild._runBuilder (package:build_runner_core/src/generate/build_impl.dart:373:36)
#55     _SingleBuild._runPhases.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:319:20)
<asynchronous suspension>
#56     _SingleBuild._runPhases.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart)
#57     _NoOpBuildPerformanceTracker.trackBuildPhase (package:build_runner_core/src/generate/performance_tracker.dart:184:15)
#58     _SingleBuild._runPhases.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:315:47)
#59     NoOpTimeTracker.track (package:timing/src/timing.dart:222:44)
#60     _SingleBuild._runPhases (package:build_runner_core/src/generate/build_impl.dart:309:32)
#61     logTimedAsync (package:build_runner_core/src/logging/logging.dart:25:30)
#62     _SingleBuild._safeBuild.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:266:26)
#63     _rootRun (dart:async/zone.dart:1190:13)
#64     _CustomZone.run (dart:async/zone.dart:1093:19)
#65     _runZoned (dart:async/zone.dart:1630:10)
#66     runZonedGuarded (dart:async/zone.dart:1618:12)
#67     runZoned (dart:async/zone.dart:1547:12)
#68     _SingleBuild._safeBuild (package:build_runner_core/src/generate/build_impl.dart:261:5)
#69     _SingleBuild.run (package:build_runner_core/src/generate/build_impl.dart:208:24)
#70     BuildImpl.run (package:build_runner_core/src/generate/build_impl.dart:94:56)
#71     BuildRunner.run (package:build_runner_core/src/generate/build_runner.dart:25:14)
#72     build (package:build_runner/src/generate/build.dart:107:21)
<asynchronous suspension>
#73     BuildCommand._run (package:build_runner/src/entrypoint/build.dart:35:24)
#74     BuildCommand.run.<anonymous closure> (package:build_runner/src/entrypoint/build.dart:31:15)
#75     _rootRun (dart:async/zone.dart:1190:13)
#76     _CustomZone.run (dart:async/zone.dart:1093:19)
#77     _runZoned (dart:async/zone.dart:1630:10)
#78     runZoned (dart:async/zone.dart:1550:10)
#79     withEnabledExperiments (package:build/src/experiments.dart:18:5)
#80     BuildCommand.run (package:build_runner/src/entrypoint/build.dart:30:12)
#81     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#82     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#83     new Future.sync (dart:async/future.dart:223:31)
#84     CommandRunner.run (package:args/command_runner.dart:112:14)
#85     run (package:build_runner/src/entrypoint/run.dart:25:31)
<asynchronous suspension>
#86     main (file:///C:/_eic/app/eic_app_front/.dart_tool/build/entrypoint/build.dart:27:22)
#87     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:32)
#88     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

package:analyzer/src/dart/analysis/driver.dart 1347:9                                         AnalysisDriver._computeAnalysisResult2.<fn>
package:analyzer/src/dart/analysis/performance_logger.dart 32:15                              PerformanceLog.run
package:analyzer/src/dart/analysis/driver.dart 1294:20                                        AnalysisDriver._computeAnalysisResult2
package:analyzer/src/dart/analysis/driver.dart 1247:14                                        AnalysisDriver._computeAnalysisResult.<fn>
dart:async                                                                                    runZoned
package:analyzer/dart/element/null_safety_understanding_flag.dart 42:12                       NullSafetyUnderstandingFlag.enableNullSafetyTypes
package:analyzer/src/dart/analysis/driver.dart 1246:40                                        AnalysisDriver._computeAnalysisResult
package:analyzer/src/dart/analysis/driver.dart 1372:41                                        AnalysisDriver._computeErrors
package:analyzer/src/dart/analysis/driver.dart 979:20                                         AnalysisDriver.performWork
package:analyzer/src/dart/analysis/driver.dart 2013:24                                        AnalysisDriverScheduler._run
package:analyzer/src/dart/analysis/driver.dart 1936:5                                         AnalysisDriverScheduler.start
package:build_resolvers/src/analysis_driver.dart 62:13                                        analysisDriver
package:build_resolvers/src/resolver.dart 306:26                                              AnalyzerResolvers._ensureInitialized.<fn>
package:build_resolvers/src/resolver.dart                                                     AnalyzerResolvers._ensureInitialized.<fn>
package:build_resolvers/src/resolver.dart 309:6                                               AnalyzerResolvers._ensureInitialized
package:build_resolvers/src/resolver.dart 314:11                                              AnalyzerResolvers.get
package:build_runner_core/src/performance_tracking/performance_tracking_resolvers.dart 19:58  PerformanceTrackingResolvers.get.<fn>
package:build_runner_core/src/generate/performance_tracker.dart 302:15                        _NoOpBuilderActionTracker.trackStage
package:build_runner_core/src/performance_tracking/performance_tracking_resolvers.dart 19:16  PerformanceTrackingResolvers.get
package:build                                                                                 BuildStepImpl.resolver
package:source_gen/src/builder.dart 72:32                                                     _Builder.build
package:build                                                                                 runBuilder
package:build_runner_core/src/generate/build_impl.dart 485:19                                 _SingleBuild._runForInput.<fn>.<fn>.<fn>
package:build_runner_core/src/generate/performance_tracker.dart 302:15                        _NoOpBuilderActionTracker.trackStage
package:build_runner_core/src/generate/build_impl.dart 483:23                                 _SingleBuild._runForInput.<fn>.<fn>
package:build_runner_core/src/generate/build_impl.dart                                        _SingleBuild._runForInput.<fn>.<fn>
package:timing/src/timing.dart 222:44                                                         NoOpTimeTracker.track
package:build_runner_core/src/generate/build_impl.dart 440:22                                 _SingleBuild._runForInput.<fn>
package:pool/pool.dart 127:28                                                                 Pool.withResource
package:build_runner_core/src/generate/build_impl.dart 436:17                                 _SingleBuild._runForInput
package:build_runner_core/src/generate/build_impl.dart 374:38                                 _SingleBuild._runBuilder.<fn>
dart:async                                                                                    Future.wait
package:build_runner_core/src/generate/build_impl.dart 373:36                                 _SingleBuild._runBuilder
package:build_runner_core/src/generate/build_impl.dart 319:20                                 _SingleBuild._runPhases.<fn>.<fn>
package:build_runner_core/src/generate/build_impl.dart                                        _SingleBuild._runPhases.<fn>.<fn>
package:build_runner_core/src/generate/performance_tracker.dart 184:15                        _NoOpBuildPerformanceTracker.trackBuildPhase
package:build_runner_core/src/generate/build_impl.dart 315:47                                 _SingleBuild._runPhases.<fn>
package:timing/src/timing.dart 222:44                                                         NoOpTimeTracker.track
package:build_runner_core/src/generate/build_impl.dart 309:32                                 _SingleBuild._runPhases
package:build_runner_core/src/logging/logging.dart 25:30                                      logTimedAsync
package:build_runner_core/src/generate/build_impl.dart 266:26                                 _SingleBuild._safeBuild.<fn>
dart:async                                                                                    runZoned
package:build_runner_core/src/generate/build_impl.dart 261:5                                  _SingleBuild._safeBuild
package:build_runner_core/src/generate/build_impl.dart 208:24                                 _SingleBuild.run
package:build_runner_core/src/generate/build_impl.dart 94:56                                  BuildImpl.run
package:build_runner_core/src/generate/build_runner.dart 25:14                                BuildRunner.run
package:build_runner                                                                          BuildCommand.run
package:args/command_runner.dart 197:27                                                       CommandRunner.runCommand
package:args/command_runner.dart 112:25                                                       CommandRunner.run.<fn>
dart:async                                                                                    new Future.sync
package:args/command_runner.dart 112:14                                                       CommandRunner.run
package:build_runner                                                                          run
.dart_tool\build\entrypoint\build.dart 27:22                                                  main

This is the code of "customers_screen_arguments.dart":

enum CallingAction { Customers1, CustomersOfAdministrator }

class CustomersScreenArguments {
  final CallingAction callingAction;
  final int administratorCode;
  CustomersScreenArguments(this.callingAction, {this.administratorCode});
}

This is the result of "flutter --version:

Flutter 1.22.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8874f21e79 (3 days ago) • 2020-10-29 14:14:35 -0700
Engine • revision a1440ca392
Tools • Dart 2.10.3

This is the pubspec.yaml:

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  provider: ^4.0.5
  http: ^0.12.0+2
  shared_preferences: ^0.5.6+3
  json_annotation: ^3.0.0
  material_design_icons_flutter: 4.0.5345
   flutter_icons: ^1.1.0 
  url_launcher: ^5.4.10
  
  cupertino_icons: ^0.1.2

  package_info: ^0.4.1

dev_dependencies:
  flutter_test:
    sdk: flutter
  json_serializable: ^3.3.0
  build_runner: ^1.6.7
  sqflite: ^1.3.0
  path: ^1.6.4

flutter:

  uses-material-design: true
  assets:
    - assets/collaboration.png
```

Thank you.
@Alex-911
Copy link

Alex-911 commented Nov 2, 2020

still working on it.

@mulieriq
Copy link

mulieriq commented Nov 3, 2020

I am getting the same error

@Alex-911
Copy link

Alex-911 commented Nov 3, 2020

try with Analyzer: 0.40.5 as dependency if it work 🤞.

@FabioPagano
Copy link
Author

I've put in the pubspec.yaml the override:
dependency_overrides: analyzer: 0.40.5
but the error is the same.

@kevmoo
Copy link
Collaborator

kevmoo commented Nov 3, 2020

@FabioPagano – would you include the full contents of pubspec.lock here?

@FabioPagano
Copy link
Author

FabioPagano commented Nov 4, 2020

Here is the pubspec.lock:

# Generated by pub

packages:
  _fe_analyzer_shared:
    dependency: transitive
    description:
      name: _fe_analyzer_shared
      url: "https://pub.dartlang.org"
    source: hosted
    version: "12.0.0"
  analyzer:
    dependency: "direct overridden"
    description:
      name: analyzer
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.40.5"
  args:
    dependency: transitive
    description:
      name: args
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.6.0"
  async:
    dependency: transitive
    description:
      name: async
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.5.0-nullsafety.1"
  boolean_selector:
    dependency: transitive
    description:
      name: boolean_selector
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.0-nullsafety.1"
  build:
    dependency: transitive
    description:
      name: build
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.5.0"
  build_config:
    dependency: transitive
    description:
      name: build_config
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.4.2"
  build_daemon:
    dependency: transitive
    description:
      name: build_daemon
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.4"
  build_resolvers:
    dependency: transitive
    description:
      name: build_resolvers
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.4.3"
  build_runner:
    dependency: "direct dev"
    description:
      name: build_runner
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.10.4"
  build_runner_core:
    dependency: transitive
    description:
      name: build_runner_core
      url: "https://pub.dartlang.org"
    source: hosted
    version: "6.0.3"
  built_collection:
    dependency: transitive
    description:
      name: built_collection
      url: "https://pub.dartlang.org"
    source: hosted
    version: "4.3.2"
  built_value:
    dependency: transitive
    description:
      name: built_value
      url: "https://pub.dartlang.org"
    source: hosted
    version: "7.1.0"
  characters:
    dependency: transitive
    description:
      name: characters
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.0-nullsafety.3"
  charcode:
    dependency: transitive
    description:
      name: charcode
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.2.0-nullsafety.1"
  checked_yaml:
    dependency: transitive
    description:
      name: checked_yaml
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.0.2"
  cli_util:
    dependency: transitive
    description:
      name: cli_util
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.2.0"
  clock:
    dependency: transitive
    description:
      name: clock
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.0-nullsafety.1"
  code_builder:
    dependency: transitive
    description:
      name: code_builder
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.5.0"
  collection:
    dependency: transitive
    description:
      name: collection
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.15.0-nullsafety.3"
  convert:
    dependency: transitive
    description:
      name: convert
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.1"
  crypto:
    dependency: transitive
    description:
      name: crypto
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.5"
  cupertino_icons:
    dependency: "direct main"
    description:
      name: cupertino_icons
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.3"
  dart_style:
    dependency: transitive
    description:
      name: dart_style
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.3.9"
  fake_async:
    dependency: transitive
    description:
      name: fake_async
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.2.0-nullsafety.1"
  ffi:
    dependency: transitive
    description:
      name: ffi
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.3"
  file:
    dependency: transitive
    description:
      name: file
      url: "https://pub.dartlang.org"
    source: hosted
    version: "5.2.1"
  fixnum:
    dependency: transitive
    description:
      name: fixnum
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.10.11"
  flutter:
    dependency: "direct main"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_icons:
    dependency: "direct main"
    description:
      name: flutter_icons
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.0"
  flutter_test:
    dependency: "direct dev"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_web_plugins:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.0"
  glob:
    dependency: transitive
    description:
      name: glob
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.2.0"
  graphs:
    dependency: transitive
    description:
      name: graphs
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.2.0"
  http:
    dependency: "direct main"
    description:
      name: http
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.12.2"
  http_multi_server:
    dependency: transitive
    description:
      name: http_multi_server
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.2.0"
  http_parser:
    dependency: transitive
    description:
      name: http_parser
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.1.4"
  intl:
    dependency: transitive
    description:
      name: intl
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.16.1"
  io:
    dependency: transitive
    description:
      name: io
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.3.4"
  js:
    dependency: transitive
    description:
      name: js
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.6.2"
  json_annotation:
    dependency: "direct main"
    description:
      name: json_annotation
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.1.0"
  json_serializable:
    dependency: "direct dev"
    description:
      name: json_serializable
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.5.0"
  logging:
    dependency: transitive
    description:
      name: logging
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.11.4"
  matcher:
    dependency: transitive
    description:
      name: matcher
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.12.10-nullsafety.1"
  material_design_icons_flutter:
    dependency: "direct main"
    description:
      name: material_design_icons_flutter
      url: "https://pub.dartlang.org"
    source: hosted
    version: "4.0.5345"
  meta:
    dependency: transitive
    description:
      name: meta
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.3.0-nullsafety.3"
  mime:
    dependency: transitive
    description:
      name: mime
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.9.7"
  nested:
    dependency: transitive
    description:
      name: nested
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.4"
  node_interop:
    dependency: transitive
    description:
      name: node_interop
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.2.0"
  node_io:
    dependency: transitive
    description:
      name: node_io
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.1"
  package_config:
    dependency: transitive
    description:
      name: package_config
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.9.3"
  package_info:
    dependency: "direct main"
    description:
      name: package_info
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.4.3"
  path:
    dependency: "direct dev"
    description:
      name: path
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.8.0-nullsafety.1"
  path_provider_linux:
    dependency: transitive
    description:
      name: path_provider_linux
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1+2"
  path_provider_platform_interface:
    dependency: transitive
    description:
      name: path_provider_platform_interface
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.0.3"
  path_provider_windows:
    dependency: transitive
    description:
      name: path_provider_windows
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.4+1"
  pedantic:
    dependency: transitive
    description:
      name: pedantic
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.9.2"
  platform:
    dependency: transitive
    description:
      name: platform
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.2.1"
  plugin_platform_interface:
    dependency: transitive
    description:
      name: plugin_platform_interface
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.0.3"
  pool:
    dependency: transitive
    description:
      name: pool
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.4.0"
  process:
    dependency: transitive
    description:
      name: process
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.0.13"
  provider:
    dependency: "direct main"
    description:
      name: provider
      url: "https://pub.dartlang.org"
    source: hosted
    version: "4.3.2+2"
  pub_semver:
    dependency: transitive
    description:
      name: pub_semver
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.4.4"
  pubspec_parse:
    dependency: transitive
    description:
      name: pubspec_parse
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.5"
  quiver:
    dependency: transitive
    description:
      name: quiver
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.4+1"
  shared_preferences:
    dependency: "direct main"
    description:
      name: shared_preferences
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.5.12+2"
  shared_preferences_linux:
    dependency: transitive
    description:
      name: shared_preferences_linux
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.2+2"
  shared_preferences_macos:
    dependency: transitive
    description:
      name: shared_preferences_macos
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1+10"
  shared_preferences_platform_interface:
    dependency: transitive
    description:
      name: shared_preferences_platform_interface
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.0.4"
  shared_preferences_web:
    dependency: transitive
    description:
      name: shared_preferences_web
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.2+7"
  shared_preferences_windows:
    dependency: transitive
    description:
      name: shared_preferences_windows
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1+1"
  shelf:
    dependency: transitive
    description:
      name: shelf
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.7.9"
  shelf_web_socket:
    dependency: transitive
    description:
      name: shelf_web_socket
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.2.3"
  sky_engine:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.99"
  source_gen:
    dependency: transitive
    description:
      name: source_gen
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.9.8"
  source_span:
    dependency: transitive
    description:
      name: source_span
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.8.0-nullsafety.2"
  sqflite:
    dependency: "direct dev"
    description:
      name: sqflite
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.3.2+1"
  sqflite_common:
    dependency: transitive
    description:
      name: sqflite_common
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.0.2+1"
  stack_trace:
    dependency: transitive
    description:
      name: stack_trace
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.10.0-nullsafety.1"
  stream_channel:
    dependency: transitive
    description:
      name: stream_channel
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.0-nullsafety.1"
  stream_transform:
    dependency: transitive
    description:
      name: stream_transform
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.2.0"
  string_scanner:
    dependency: transitive
    description:
      name: string_scanner
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.0-nullsafety.1"
  synchronized:
    dependency: transitive
    description:
      name: synchronized
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.2.0+2"
  term_glyph:
    dependency: transitive
    description:
      name: term_glyph
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.2.0-nullsafety.1"
  test_api:
    dependency: transitive
    description:
      name: test_api
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.2.19-nullsafety.2"
  timing:
    dependency: transitive
    description:
      name: timing
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.1+2"
  typed_data:
    dependency: transitive
    description:
      name: typed_data
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.3.0-nullsafety.3"
  url_launcher:
    dependency: "direct main"
    description:
      name: url_launcher
      url: "https://pub.dartlang.org"
    source: hosted
    version: "5.7.8"
  url_launcher_linux:
    dependency: transitive
    description:
      name: url_launcher_linux
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1+3"
  url_launcher_macos:
    dependency: transitive
    description:
      name: url_launcher_macos
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1+8"
  url_launcher_platform_interface:
    dependency: transitive
    description:
      name: url_launcher_platform_interface
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.0.9"
  url_launcher_web:
    dependency: transitive
    description:
      name: url_launcher_web
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.5"
  url_launcher_windows:
    dependency: transitive
    description:
      name: url_launcher_windows
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1+1"
  vector_math:
    dependency: transitive
    description:
      name: vector_math
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.1.0-nullsafety.3"
  watcher:
    dependency: transitive
    description:
      name: watcher
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.9.7+15"
  web_socket_channel:
    dependency: transitive
    description:
      name: web_socket_channel
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.0"
  win32:
    dependency: transitive
    description:
      name: win32
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.7.3"
  xdg_directories:
    dependency: transitive
    description:
      name: xdg_directories
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.1.2"
  yaml:
    dependency: transitive
    description:
      name: yaml
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.2.1"
sdks:
  dart: ">=2.10.2 <2.11.0"
  flutter: ">=1.22.2 <2.0.0"

Thank you.

@Alex-911
Copy link

Alex-911 commented Nov 4, 2020

remove the version number from build_runner and run the command again
flutter pub run build_runner build --delete-conflicting-outputs

its wired but works for me.

@mulieriq
Copy link

mulieriq commented Nov 4, 2020

try with Analyzer: 0.40.5 as dependency if it work 🤞.

Awesome it worked

@FabioPagano
Copy link
Author

@Alex-911

remove the version number from build_runner and run the command again
flutter pub run build_runner build --delete-conflicting-outputs

its wired but works for me.

Don't know if I've done right: in pubspec.yaml I've changed (in section "dev_dependencies") the dependency "build_runner: ^1.6.7" to "build_runner:" (without the number), but I've had the same error "The getter 'definingUnit' was called on null". Please advise if I had to do something different.

If needed, I have no problem to send the full source code for analysis.

Thank you.

@FabioPagano
Copy link
Author

@EricRootLee

try with Analyzer: 0.40.5 as dependency if it work 🤞.

Awesome it worked

Please Eric may you kindly share your pubspec.yaml and pubspec.lock?

Thank you.

@ashgarg143
Copy link

try with Analyzer: 0.40.5 as dependency if it work crossed_fingers.

Awesome it worked

Hey got the same error after flutter upgrade and tried this by adding analyzer: ^0.40.6 in dependencies but still getting same error. Can you please help.
If nothing works i am thinking of degrading my flutter version.
Thanks in advance

@iktakahiro
Copy link

same error here, my solution is downgrading build_runner: 1.10.2

@JDLegaspi
Copy link

JDLegaspi commented Nov 6, 2020

same error here, my solution is downgrading build_runner: 1.10.2

Thanks @iktakahiro worked for me on: Flutter (Channel master, 1.24.0-8.0.pre.111, on Mac OS X 10.15.7)

I had to run the following for it to work:

flutter clean 
flutter upgrade
flutter packages pub upgrade 
flutter pub run build_runner build

@kevmoo
Copy link
Collaborator

kevmoo commented Nov 6, 2020

Any thoughts here @jakemac53 and @natebosch ?

@natebosch
Copy link
Member

cc @scheglov

I'm having a hard time following what we've learned so far, are there definite versions of analyzer where this does and doesn't work? I would not expect the build_runner version to impact this, except for the indirect ways it influences which version of analyzer get chosen. It's possible that different versions of build_resolvers have an effect here, but I would be a little surprised.

If this is working on the latest analyzer I think the solution is to get folks upgraded to that.

@jakemac53
Copy link
Collaborator

It sounds like a bad analyzer version (0.40.6 most likely?).

There is a lot of confusion about how to pin the previous version (0.40.5), which can be done like this in your dependencies of your pubspec (you will need to add this dependency if you don't already explicitly depend on it):

dependencies:
  analyzer: 0.40.5

@scheglov
Copy link
Collaborator

scheglov commented Nov 6, 2020

Is there a way to reproduce this?
So far I was not able to find a way to do this locally.

@FabioPagano
Copy link
Author

FabioPagano commented Nov 11, 2020

To me, temporary "Arpit" solution found in
https://stackoverflow.com/questions/64658523/flutter-build-runner-watch-not-working-the-getter-definingunit-was-called-on

worked: "Downgrading build_runner to 1.10.2".

Updated pubspec.yaml:

`version: 1.0.0+1

environment:
sdk: ">=2.3.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
provider: ^4.0.5
http: ^0.12.0+2
shared_preferences: ^0.5.6+3
json_annotation: ^3.0.0
material_design_icons_flutter: ^4.0.5345
flutter_icons: ^1.1.0
url_launcher: ^5.4.10

cupertino_icons: ^0.1.2

package_info: ^0.4.1

json_serializable: ^3.5.0
analyzer: '>=0.39.0 <0.41.0'

dev_dependencies:
flutter_test:
sdk: flutter
build_runner: 1.10.2
sqflite: ^1.3.0
path: ^1.6.4

flutter:

uses-material-design: true`

@LuizFmdr
Copy link

Delete your pubspec.lock
run flutter pub get
try to run the build runner again.

@dotdotcommadot
Copy link

FYI, I came across this issue because I had it for a certain time.
Turned the real issue was that I had an import in my test suite, which contained a double slash:
`import 'my_project//my_component.dart'.

@andriivachasov-ah
Copy link

@dotdotcommadot i had the same case. Thank you for the hint 👍

@FabioPagano
Copy link
Author

FYI, I came across this issue because I had it for a certain time.
Turned the real issue was that I had an import in my test suite, which contained a double slash:
`import 'my_project//my_component.dart'.

Thank you very much, I've mentioned your answer in this stackoverflow thread: https://stackoverflow.com/questions/64658523/flutter-build-runner-watch-not-working-the-getter-definingunit-was-called-on

Here is a regular expression to find the "import" that have "//" in the same line, if needed:

(import).*?(//).*?

@miDeb
Copy link

miDeb commented Jan 9, 2021

For me, the reason for this error was an import in a test file with a relative import such as

import '../lib/ui/somefile.dart';

Changing it to a package URI fixed the issue. For reference: I discovered where this is coming from by adding debug prints to LinkedElementFactory.isLibraryUri (in vscode you can click on the package URI in the stacktrace to open this file).

@yeleibo
Copy link

yeleibo commented Jan 13, 2021

check file import not contain '//'

miDeb added a commit to miDeb/digitales_register that referenced this issue Jan 26, 2021
For some reason, analyzer didn't like this import.
See also google/json_serializable.dart#738
@hrabkin
Copy link

hrabkin commented Feb 6, 2021

For me, it was the problem with null objects in my JSON list, like:

[
   {
      "id":3,
      "name":"Aqwe"
   },
   null,
   null,
   {
      "id":5,
      "name":"Qwea"
   }
]

@kevmoo
Copy link
Collaborator

kevmoo commented Jul 13, 2021

Please get the latest dependencies and let me know if you're still having the issue!

@no-response
Copy link

no-response bot commented Aug 3, 2021

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@no-response no-response bot closed this as completed Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests