matthewtsmith / flutter_map_demo

A demo application using the Flutter Google Map plugin
16 stars 7 forks source link

Runtime display error with Dart v2 #1

Open Soundbytes opened 6 years ago

Soundbytes commented 6 years ago

compiling and running the app under Dart2 gave me a red screen on the device with the message

type '_BroadcastStream' is not a subtype of type 'Stream<List>'

It seems the error can be fixed by repacing line 7 in file lib/favorites_manager.dart

StreamController _favStreamController = new StreamController.broadcast();

with:

StreamController<List<Favorite>> _favStreamController = new StreamController<List<Favorite>>.broadcast();

(Dart2 is more rigid with type checking than Dart1)

rakshetha commented 6 years ago

there seem to be more ...VERBOSE-2:shell.cc(181)] Dart Error: Unhandled exception: type '_BroadcastSubscription' is not a subtype of type 'StreamSubscription'

0 _MyHomePageState._addFavorite (file:///Users/macsetup/Documents/myGIT/flutter_map_demo/lib/main.dart:92:5)

1 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)

2 _MyHomePageState._addFavorite (file:///Users/macsetup/Documents/myGIT/flutter_map_demo/lib/main.dart:78:22)

3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:503:14)

4 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:558:30)

5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)

6 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)

7 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)

8 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestu<…>

    [4.1 3CE48A93-077D-4470-9E90-554BF2FEE0A0 10.55.13.32.52831<->216.58.205.238:443]
    Connected Path: satisfied (Path is satisfied), interface: en0
    Duration: 76.981s, DNS @0.001s took 0.003s, TCP @0.008s took 0.014s, TLS took 0.052s
    bytes in/out: 43405/7678, packets in/out: 64/37, rtt: 0.051s, retransmitted packets: 3, out-of-order packets: 15