dart_hub icon indicating copy to clipboard operation
dart_hub copied to clipboard

Error in built.

Open lucasjinreal opened this issue 6 years ago • 3 comments

There are an error:

compiler message: lib/ui/paginated_list/paginated_list_view.dart:82:9: Error: A value of type '(#lib1::_State<dynamic>, #lib1::Page<dynamic>) → #lib1::_State<dynamic>' can't be assigned to a variable of type '(dynamic, dynamic) → dynamic'.
compiler message: Try changing the type of the left hand side, or casting the right hand side to '(dynamic, dynamic) → dynamic'.
compiler message:         _accumulate
compiler message:         ^
compiler message: file:///Users/jintian/development/flutter/.pub-cache/hosted/pub.dartlang.org/stream_ext-0.4.0/lib/stream_ext.dart:115:13: Error: The static method has type '(dynamic) → dynamic' that isn't of expected type '(dynamic) → dart.core::num'.
compiler message: Change the type of the method or the context in which it is used.
compiler message:       map = _identity;
compiler message:             ^
compiler message: file:///Users/jintian/development/flutter/.pub-cache/hosted/pub.dartlang.org/stream_ext-0.4.0/lib/stream_ext.dart:618:13: Error: The static method has type '(dynamic) → dynamic' that isn't of expected type '(dynamic) → dart.core::num'.
compiler message: Change the type of the method or the context in which it is used.
compiler message:       map = _identity;
compiler message:             ^
Compiler failed on lib/main.dart
Error launching application on iPhone X.

lucasjinreal avatar May 10 '18 03:05 lucasjinreal

I am getting this error too.

dokhanhvu avatar May 10 '18 09:05 dokhanhvu

same here

wiltwitt avatar Jun 05 '18 20:06 wiltwitt

The problem seems to have come from the stream_ext library. I tried using rxdart instead and have replaced with the following code. It seems to work...

`

Stream<_State<T>> _buildStateStream<T>( StreamController<Bookmark> controller) { var _observable = new Observable(controller.stream.asBroadcastStream());

return _observable
    .distinct((Bookmark item1, Bookmark item2) => item1 == item2)
    .asyncMap((Bookmark bookmark) => loadPage(bookmark))
    .scan((prevState, newPage, int i) {
  List<T> newItems;

  if (prevState.items != null) {
    prevState.items.addAll((newPage as Page<T>).items);
    newItems = prevState.items;
  } else {
    newItems = (newPage as Page<T>).items;
  }

  return new _State<T>(newItems, (newPage as Page<T>).bookmark);
}, new _State(null, null));

}

`

jinfeei avatar Aug 27 '18 00:08 jinfeei