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 exception thrown in changeNotifier after it creates the object which should not make it null #20536

Closed
DartBot opened this issue Aug 14, 2014 · 3 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.

Comments

@DartBot
Copy link

DartBot commented Aug 14, 2014

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Execute code that invokes ChangeNotifier.changes
  2. In certain cases, the following exception is produced:

The null object does not have a getter 'stream'.

NoSuchMethodError: method not found: 'stream'
Receiver: null
Arguments: []

STACKTRACE:

­0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)

­1 ChangeNotifier.changes (package:observe/src/change_notifier.dart:29:21)

For reference, line 24-30 from change_notifier.dart:

  Stream<List<ChangeRecord>> get changes {
    if (_changes == null) {
      _changes = new StreamController.broadcast(sync: true,
          onListen: observed, onCancel: unobserved);
    }
    return _changes.stream;
  }

What is the expected output? What do you see instead?
_changes should never be null, so no exception should be thrown.

What version of the product are you using?
Dartium Version 37.0.2062.0 (287872) (64-bit)

On what operating system?
Linux

What browser (if applicable)?
Dartium Version 37.0.2062.0 (287872) (64-bit)

Please provide any additional information below.

C1

@floitschG
Copy link
Contributor

Added Area-Pkg, Pkg-Observe, Triaged labels.

@jakemac53
Copy link
Contributor

Hmm, this is really weird. Is it possible for you to attach a repro of this?

Technically, StreamController.broadcast is a factory method and as such could return a null I believe (although this would be bad practice imo since factories and constructors appear identical in dart). However in reality it looks like it does not do that...

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/observe#69.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.
Projects
None yet
Development

No branches or pull requests

4 participants