Angular.Dart and the Root Controller/Component - dart

I have an Angular.Dart program and want to add some Angular functionality to the main program (outside of any components). I've been reading about how to accomplish this, and it seems that you have to use the .rootContextType property to accomplish this.
This is my main() function before I tried anything, and it's working fine:
main() {
applicationFactory()
.addModule(new MainInitModule())
.run();
}
Next, I defined an empty class (to be my Root Controller) as follows:
#Injectable()
class RootController {
}
And I modified my main() function as follows:
main() {
applicationFactory()
.rootContextType(RootController)
.addModule(new MainInitModule())
.run();
}
Trying to run this produce the following error messages / stack traces:
Missing getter: (o) => o.openAction
STACKTRACE:
#0 StaticFieldGetterFactory.getter (package:angular/change_detection/dirty_checking_change_detector_static.dart:12:25)
#1 DirtyCheckingRecord.object= (package:angular/change_detection/dirty_checking_change_detector.dart:545:43)
#2 _FieldHandler.acceptValue (package:angular/change_detection/watch_group.dart:631:17)
#3 WatchGroup.addFieldWatch (package:angular/change_detection/watch_group.dart:167:29)
#4 FieldReadAST.setupWatch (package:angular/change_detection/ast.dart:68:31)
#5 WatchGroup.addCollectionWatch (package:angular/change_detection/watch_group.dart:176:49)
#6 CollectionAST.setupWatch (package:angular/change_detection/ast.dart:139:36)
#7 WatchGroup._addEvalWatch (package:angular/change_detection/watch_group.dart:235:52)
#8 WatchGroup.addFunctionWatch (package:angular/change_detection/watch_group.dart:199:20)
#9 PureFunctionAST.setupWatch (package:angular/change_detection/ast.dart:88:34)
#10 WatchGroup.watch (package:angular/change_detection/watch_group.dart:141:62)
#11 Scope.watchAST (package:angular/core/scope.dart:271:23)
#12 AttrMustache.AttrMustache.<anonymous closure> (package:angular/core_dom/mustache.dart:38:32)
#13 NodeAttrs.listenObserverChanges (package:angular/core_dom/directive.dart:79:13)
#14 AttrMustache.AttrMustache (package:angular/core_dom/mustache.dart:34:33)
#15 ElementBinder._createDirectiveFactories (package:angular/core_dom/element_binder.dart:259:11)
#16 ElementBinder.bind (package:angular/core_dom/element_binder.dart:294:32)
#17 ViewFactory._bindTagged (package:angular/core_dom/view_factory.dart:79:36)
#18 ViewFactory._link (package:angular/core_dom/view_factory.dart:119:24)
#19 ViewFactory.call (package:angular/core_dom/view_factory.dart:58:10)
#20 Application.run.<anonymous closure>.<anonymous closure> (package:angular/application.dart:186:24)
#21 _rootRunUnary (dart:async/zone.dart:902)
#22 _ZoneDelegate.runUnary (dart:async/zone.dart:508)
#23 _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:122:63)
#24 VmTurnZone._onRunBase (package:angular/core/zone.dart:104:16)
#25 _onRunUnary (package:angular/core/zone.dart:122:17)
#26 _CustomZone.runUnary (dart:async/zone.dart:804)
#27 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#28 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#29 _Future._completeWithValue (dart:async/future_impl.dart:358)
#30 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:412)
#31 _rootRun (dart:async/zone.dart:895)
#32 _ZoneDelegate.run (dart:async/zone.dart:501)
#33 _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:127:45)
#34 VmTurnZone._finishTurn (package:angular/core/zone.dart:166:34)
#35 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#36 _onRun (package:angular/core/zone.dart:118:17)
#37 _CustomZone.run (dart:async/zone.dart:796)
#38 VmTurnZone.run (package:angular/core/zone.dart:257:40)
#39 Application.run (package:angular/application.dart:174:22)
#40 main (http://localhost:8080/datacea.dart:157:11)
#41 main (http://localhost:8080/datacea.html_bootstrap.dart:93:11)
The null object does not have a method 'call'.
NoSuchMethodError: method not found: 'call'
Receiver: null
Arguments: [Instance of 'RootController']
STACKTRACE:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26)
#2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26)
#3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69)
#4 RootScope.flush (package:angular/core/scope.dart:860:38)
#5 Scope.apply (package:angular/core/scope.dart:317:23)
#6 RootScope.RootScope.<anonymous closure> (package:angular/core/scope.dart:768:12)
#7 _rootRun (dart:async/zone.dart:895)
#8 _ZoneDelegate.run (dart:async/zone.dart:501)
#9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21)
#10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#11 _onRun (package:angular/core/zone.dart:118:17)
#12 _CustomZone.run (dart:async/zone.dart:796)
#13 VmTurnZone.run (package:angular/core/zone.dart:257:40)
#14 Application.run (package:angular/application.dart:174:22)
#15 main (http://localhost:8080/datacea.dart:157:11)
#16 main (http://localhost:8080/datacea.html_bootstrap.dart:93:11)
The null object does not have a method 'call'.
NoSuchMethodError: method not found: 'call'
Receiver: null
Arguments: [Instance of 'RootController']
STACKTRACE:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26)
#2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26)
#3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69)
#4 RootScope.flush.<anonymous closure> (package:angular/core/scope.dart:884:57)
#5 RootScope.flush (package:angular/core/scope.dart:896:9)
#6 Scope.apply (package:angular/core/scope.dart:317:23)
#7 RootScope.RootScope.<anonymous closure> (package:angular/core/scope.dart:768:12)
#8 _rootRun (dart:async/zone.dart:895)
#9 _ZoneDelegate.run (dart:async/zone.dart:501)
#10 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21)
#11 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#12 _onRun (package:angular/core/zone.dart:118:17)
#13 _CustomZone.run (dart:async/zone.dart:796)
#14 VmTurnZone.run (package:angular/core/zone.dart:257:40)
#15 Application.run (package:angular/application.dart:174:22)
#16 main (http://localhost:8080/datacea.dart:157:11)
#17 main (http://localhost:8080/datacea.html_bootstrap.dart:93:11)
Exception: The null object does not have a method 'call'.
NoSuchMethodError: method not found: 'call'
Receiver: null
Arguments: [Instance of 'RootController'] (package:angular/change_detection/dirty_checking_change_detector.dart:569)
I've been racking my brain over how to resolve this for three days now with no success. Can anyone assist?

Related

flutter_blue Connect Macos bluetooth device.discoverServices error

macos version 11.6 flutter_blue version 0.8.0
The device service has been failed to get, but I can get the service normally when I get it on my mobile phone. However, the service is not available on the Mac OS
Error occurred at
var services = device.discoverServices();
2021-11-16 11:32:03.486 flutter_xxxx[43362:321219] uuid: xxxxxx-23e0-4bdc-ac16-xxxxxxxx value: (null)
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormatException: The format is invalid
#0 Guid._fromString (package:flutter_blue/src/guid.dart:45:7)
#1 new Guid (package:flutter_blue/src/guid.dart:15:39)
#2 new BluetoothCharacteristic.fromProto (package:flutter_blue/src/bluetooth_characteristic.dart:35:27)
#3 new BluetoothService.fromProto.<anonymous closure> (package:flutter_blue/src/bluetooth_service.dart:19:29)
#4 MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
#5 ListIterator.moveNext (dart:_internal/iterable.dart:342:26)
#6 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#7 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#8 new List.of (dart:core-patch/array_patch.dart:50:28)
#9 ListIterable.toList (dart:_internal/iterable.dart:213:44)
#10 new BluetoothService.fromProto (package:flutter_blue/src/bluetooth_service.dart:20:14)
#11 BluetoothDevice.discoverServices.<anonymous closure>.<anonymous closure> (package:flutter_blue/src/bluetooth_device.dart:67:38)
#12 MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
#13 ListIterator.moveNext (dart:_internal/iterable.dart:342:26)
#14 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#15 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#16 new List.of (dart:core-patch/array_patch.dart:50:28)
#17 ListIterable.toList (dart:_internal/iterable.dart:213:44)
#18 BluetoothDevice.discoverServices.<anonymous closure> (package:flutter_blue/src/bluetooth_device.dart:67:69)
#19 _MapStream._handleData (dart:async/stream_pipe.dart:213:31)
#20 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#21 _rootRunUnary (dart:async/zone.dart:1436:47)
#22 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#23 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#24 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#25 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#26 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#27 _MapStream._handleData (dart:async/stream_pipe.dart:218:10)
#28 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#29 _rootRunUnary (dart:async/zone.dart:1436:47)
#30 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#31 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#32 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#33 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#34 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#35 _WhereStream._handleData (dart:async/stream_pipe.dart:195:12)
#36 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#37 _rootRunUnary (dart:async/zone.dart:1436:47)
#38 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#39 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#40 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#41 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#42 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#43 _MapStream._handleData (dart:async/stream_pipe.dart:218:10)
#44 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#45 _rootRunUnary (dart:async/zone.dart:1436:47)
#46 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#47 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#48 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#49 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#50 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#51 _MapStream._handleData (dart:async/stream_pipe.dart:218:10)
#52 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#53 _rootRunUnary (dart:async/zone.dart:1436:47)
#54 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#55 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#56 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#57 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#58 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#59 _WhereStream._handleData (dart:async/stream_pipe.dart:195:12)
#60 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#61 _rootRunUnary (dart:async/zone.dart:1436:47)
#62 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#63 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#64 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#65 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
#66 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
#67 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
#68 _rootRun (dart:async/zone.dart:1420:47)
#69 _CustomZone.run (dart:async/zone.dart:1328:19)
#70 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#71 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#72 _rootRun (dart:async/zone.dart:1428:13)
#73 _CustomZone.run (dart:async/zone.dart:1328:19)
#74 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#75 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#76 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#77 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
Error occurred at
guid.dart
static List<int> _fromString(String input) {
if (input == null) {
throw new ArgumentError("Input was null");
}
input = _removeNonHexCharacters(input);
final bytes = hex.decode(input);
if (bytes.length != 16) {
throw new FormatException("The format is invalid");
}
return bytes;
}
string input is "" error . can you help me analyze why

I use socket.io-client-dart. What does BINARY_EVENT mean? I frequently get error because of this

I noticed that the function onpacket(packet) is used to classify server messages, and has five cases in there. I think only EVENT is a custom message, but I often receive BINARY_EVENT with null data, along with an error. I don't know why. My server is using SpringBoot+netty-socket-io.
The following is the error message.
E/flutter (19571): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: Closure call with mismatched arguments: function 'call'
E/flutter (19571): Receiver: Closure: (String, [dynamic]) => void from Function 'emit':.
E/flutter (19571): Tried calling: call()
E/flutter (19571): Found: call(String, [dynamic]) => void
E/flutter (19571): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
E/flutter (19571): #1 Function._apply (dart:core-patch/function_patch.dart:12:68)
E/flutter (19571): #2 Function.apply (dart:core-patch/function_patch.dart:33:12)
E/flutter (19571): #3 Socket.onevent (package:socket_io_client/src/socket.dart:278:18)
E/flutter (19571): #4 Socket.onpacket (package:socket_io_client/src/socket.dart:238:9)
E/flutter (19571): #5 EventEmitter.emit. (package:socket_io_common/src/util/event_emitter.dart:52:14)
E/flutter (19571): #6 List.forEach (dart:core-patch/growable_array.dart:282:8)
E/flutter (19571): #7 EventEmitter.emit (package:socket_io_common/src/util/event_emitter.dart:51:11)
E/flutter (19571): #8 Manager.ondecoded (package:socket_io_client/src/manager.dart:320:5)
E/flutter (19571): #9 EventEmitter.emit. (package:socket_io_common/src/util/event_emitter.dart:52:14)
E/flutter (19571): #10 List.forEach (dart:core-patch/growable_array.dart:282:8)
E/flutter (19571): #11 EventEmitter.emit (package:socket_io_common/src/util/event_emitter.dart:51:11)
E/flutter (19571): #12 Decoder.add (package:socket_io_common/src/parser/parser.dart:173:16)
E/flutter (19571): #13 Manager.ondata (package:socket_io_client/src/manager.dart:311:13)
E/flutter (19571): #14 EventEmitter.emit. (package:socket_io_common/src/util/event_emitter.dart:52:14)
E/flutter (19571): #15 List.forEach (dart:core-patch/growable_array.dart:282:8)
E/flutter (19571): #16 EventEmitter.emit (package:socket_io_common/src/util/event_emitter.dart:51:11)
E/flutter (19571): #17 Socket.onPacket (package:socket_io_client/src/engine/socket.dart:467:11)
E/flutter (19571): #18 Socket.setTransport. (package:socket_io_client/src/engine/socket.dart:292:34)
E/flutter (19571): #19 EventEmitter.emit. (package:socket_io_common/src/util/event_emitter.dart:52:14)
E/flutter (19571): #20 List.forEach (dart:core-patch/growable_array.dart:282:8)
E/flutter (19571): #21 EventEmitter.emit (package:socket_io_common/src/util/event_emitter.dart:51:11)
E/flutter (19571): #22 Transport.onPacket (package:socket_io_client/src/engine/transport/transport.dart:128:5)
E/flutter (19571): #23 Transport.onData (package:socket_io_client/src/engine/transport/transport.dart:122:5)
E/flutter (19571): #24 IOWebSocketTransport.addEventListeners. (package:socket_io_client/src/engine/transport/io_websocket_transport.dart:67:7)
E/flutter (19571): #25 _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter (19571): #26 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (19571): #27 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (19571): #28 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (19571): #29 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
E/flutter (19571): #30 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:779:19)
E/flutter (19571): #31 _StreamController._add (dart:async/stream_controller.dart:655:7)
E/flutter (19571): #32 _StreamController.add (dart:async/stream_controller.dart:597:5)
E/flutter (19571): #33 new _WebSocketImpl._fromSocket. (dart:_http/websocket_impl.dart:1146:21)
E/flutter (19571): #34 _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter (19571): #35 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (19571): #36 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (19571): #37 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (19571): #38 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
E/flutter (19571): #39 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:70:11)
E/flutter (19571): #40 _EventSinkWrapper.add (dart:async/stream_transformers.dart:17:11)
E/flutter (19571): #41 _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:341:22)
E/flutter (19571): #42 _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:233:46)
E/flutter (19571): #43 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:122:24)
E/flutter (19571): #44 _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter (19571): #45 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (19571): #46 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (19571): #47 _BufferingSt

How to encode and decode protobuf messages from a netty server (dart/flutter)

I am trying to decode messages from netty server and I'm not entirely sure if the data decoded is decoded properly. Do I need to do anything with the dart socket to make it work with the protobuf message being sent from netty? Do I also need to do anything before writing any message? Also do I keep parsing on every time it receives data or when it calls onDone?
Socket.connect(ip, port).then((Socket sock) {
print("Connected");
socket = sock;
socket.setOption(SocketOption.tcpNoDelay, true);
socket.listen(onReceive,
onError: (e) {
print('Server error: $e');
},
onDone: onDoneEvent,
cancelOnError: false);
});
The server channel handlers:
p.addLast(new ProtobufVarint32FrameDecoder());
p.addLast(new MultiplePacketDecoder(decoders));
p.addLast(new ProtobufVarint32LengthFieldPrepender());
p.addLast(new ProtobufEncoder());
p.addLast(processingHandler);
Edit
Oh and by the way, whenever I try to parse the message, I get this error
E/flutter (25389): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
E/flutter (25389): #0 CodedBufferReader.readTag (package:protobuf/src/protobuf/coded_buffer_reader.dart:144:7)
E/flutter (25389): #1 _mergeFromCodedBufferReader (package:protobuf/src/protobuf/coded_buffer.dart:34:21)
E/flutter (25389): #2 GeneratedMessage.mergeFromBuffer (package:protobuf/src/protobuf/generated_message.dart:173:5)
E/flutter (25389 My class): #3 PacketHandler.parseFromBytes (package:chatclientflutter/backend/packethandler.dart:32:26)
E/flutter (25389 My class): #4 Client.onDoneEvent (package:chatclientflutter/backend/client.dart:77:46)
E/flutter (25389): #5 _rootRun (dart:async/zone.dart:1120:38)
E/flutter (25389): #6 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (25389): #7 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (25389): #8 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
E/flutter (25389): #9 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
E/flutter (25389): #10 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
E/flutter (25389): #11 _SyncStreamController._sendDone (dart:async/stream_controller.dart:772:19)
E/flutter (25389): #12 _StreamController._closeUnchecked (dart:async/stream_controller.dart:629:7)
E/flutter (25389): #13 _StreamController.close (dart:async/stream_controller.dart:622:5)
E/flutter (25389): #14 _Socket._onData (dart:io-patch/socket_patch.dart:1781:21)
E/flutter (25389): #15 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (25389): #16 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (25389): #17 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (25389): #18 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
E/flutter (25389): #19 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
E/flutter (25389): #20 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
E/flutter (25389): #21 _StreamController._add (dart:async/stream_controller.dart:640:7)
E/flutter (25389): #22 _StreamController.add (dart:async/stream_controller.dart:586:5)
E/flutter (25389): #23 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1330:35)
E/flutter (25389): #24 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:837:18)
E/flutter (25389): #25 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (25389): #26 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
Please review your headers, if your header contains 'Sec-WebSocket-Extensions': 'permessage-deflate; client_max_window_bits'. It doesn't work.

Flutter debugger crashes when image picker is cancelled

When I cancel image gallery picker my flutter debugger suddenly crashes with such log. This is not possible to continue debugging.
Is it possible to skip this? Or this is just a temporary bug?
Unhandled exception:
NoSuchMethodError: The getter 'className' was called on null.
Receiver: null
Tried calling: className
#0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1 serializeProcedure (package:front_end/src/fasta/kernel/utils.dart:99:29)
#2 FrontendCompiler.compileExpression (package:vm/frontend_server.dart:482:16)
<asynchronous suspension>
#3 _FlutterFrontendCompiler.compileExpression (package:frontend_server/server.dart:62:22)
#4 listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:797:20)
<asynchronous suspension>
#5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#8 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#9 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#10 _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
#11 _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154:13)
#12 _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129:5)
#13 StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189:5)
#14 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#15 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#16 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#17 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#18 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#19 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#20 _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
#21 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
#22 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
#23 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341:5)
#24 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
#25 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#26 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#27 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#28 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#29 _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
#30 _StreamController._add (dart:async/stream_controller.dart:639:7)
#31 _StreamController.add (dart:async/stream_controller.dart:585:5)
#32 _Socket._onData (dart:io/runtime/binsocket_patch.dart:1721:41)
#33 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#34 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#35 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#36 _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
#37 _StreamController._add (dart:async/stream_controller.dart:639:7)
#38 _StreamController.add (dart:async/stream_controller.dart:585:5)
#39 new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1283:33)
#40 _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:826:14)
#41 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#42 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#43 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#44 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
Unhandled exception:
SocketException: Write failed (OS Error: Broken pipe, errno = 32), port = 0
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1112:29)
#1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#3 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#4 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
This is the code I use
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
You are canceling the picker so it returns null as expected. You should handle it.
You have also the file_picker plugin that includes image picker and also has the options to pick other file formats, if you want.

Upgraded to AngularDart 0.13.0 and getting errors about routing and di

I upgraded to AngularDart 0.13.0 and I am receiving the errors below. What is the correct way to initialize the RoutingModule with the new di package 2.0.1?
In main.dart I have:
class RoutingModule extends Module {
RoutingModule() {
bind(RouteInitializerFn, toValue: myRouteInitializer);
bind(NgRoutingUsePushState,
toFactory: (_) => new NgRoutingUsePushState.value(false));
}
}
Let me know if you think any other Modules would be relevant. The rest are just simple bind(Component); statements.
I am receiving the following 2 errors:
bind(RouteProvider): Inject list without toFactory is deprecated. Use `toInstanceOf: Type|Key` instead. Called from:
#0 Binding.bind (package:di/src/module.dart:33:11)
#1 DirectiveInjector.bind (package:angular/core_dom/directive_injector.dart:163:23)
#2 module (package:angular/routing/ng_view.dart:60:21)
#3 ElementBinder.bind (package:angular/core_dom/element_binder.dart:285:35)
#4 TaggingViewFactory._bindTagged (package:angular/core_dom/tagging_view_factory.dart:95:36)
#5 TaggingViewFactory._link (package:angular/core_dom/tagging_view_factory.dart:143:24)
#6 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:72:12)
#7 Application.run.<anonymous closure>.<anonymous closure> (package:angular/application.dart:183:22)
#8 _rootRunUnary (dart:async/zone.dart:730)
#9 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#10 _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:116:63)
#11 VmTurnZone._onRunBase (package:angular/core/zone.dart:99:16)
#12 _onRunUnary (package:angular/core/zone.dart:116:17)
#13 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#14 _CustomizedZone.runUnary (dart:async/zone.dart:667)
#15 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#16 _Future._propagateToListeners (dart:async/future_impl.dart:571)
#17 _Future._completeWithValue (dart:async/future_impl.dart:331)
#18 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#19 _rootRun (dart:async/zone.dart:723)
#20 _ZoneDelegate.run (dart:async/zone.dart:453)
#21 _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:119:43)
#22 VmTurnZone._finishTurn (package:angular/core/zone.dart:146:34)
#23 VmTurnZone._onRunBase (package:angular/core/zone.dart:106:43)
#24 _onRun (package:angular/core/zone.dart:112:17)
#25 _ZoneDelegate.run (dart:async/zone.dart:453)
#26 _CustomizedZone.run (dart:async/zone.dart:663)
#27 VmTurnZone.run (package:angular/core/zone.dart:235:40)
#28 Application.run (package:angular/application.dart:171:20)
#29 main (http://localhost/main.dart:52:11)
Closure call with mismatched arguments: function 'RoutingModule.RoutingModule.<anonymous closure>'
NoSuchMethodError: incorrect number of arguments passed to method named 'RoutingModule.RoutingModule.<anonymous closure>'
Receiver: Closure: (dynamic) => dynamic
Tried calling: RoutingModule.RoutingModule.<anonymous closure>()
Found: RoutingModule.RoutingModule.<anonymous closure>(_#0x14ac1f93)
STACKTRACE:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1 ModuleInjector.getByKey (package:di/src/injector.dart:162:48)
#2 ModuleInjector.getByKey (package:di/src/injector.dart:185:7)
#3 ModuleInjector.getByKey (package:di/src/injector.dart:145:38)
#4 ModuleInjector.getByKey (package:di/src/injector.dart:185:7)
#5 DirectiveInjector._getByKey (package:angular/core_dom/directive_injector.dart:209:72)
#6 DirectiveInjector._new (package:angular/core_dom/directive_injector.dart:287:39)
#7 DirectiveInjector._getDirectiveByKey (package:angular/core_dom/directive_injector.dart:216:94)
#8 DirectiveInjector._getByKey (package:angular/core_dom/directive_injector.dart:211:44)
#9 DirectiveInjector.getByKey (package:angular/core_dom/directive_injector.dart:198:23)
#10 DirectiveInjector.getByKey (package:angular/core_dom/directive_injector.dart:199:7)
#11 DirectiveInjector.getByKey (package:angular/core_dom/directive_injector.dart:199:7)
#12 ElementBinder._link (package:angular/core_dom/element_binder.dart:207:49)
#13 ElementBinder.bind (package:angular/core_dom/element_binder.dart:298:10)
#14 TaggingViewFactory._bindTagged (package:angular/core_dom/tagging_view_factory.dart:95:36)
#15 TaggingViewFactory._link (package:angular/core_dom/tagging_view_factory.dart:143:24)
#16 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:72:12)
#17 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:74:7)
#18 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:74:7)
#19 Application.run.<anonymous closure>.<anonymous closure> (package:angular/application.dart:183:22)
#20 _rootRunUnary (dart:async/zone.dart:730)
#21 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#22 _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:116:63)
#23 VmTurnZone._onRunBase (package:angular/core/zone.dart:99:16)
#24 _onRunUnary (package:angular/core/zone.dart:116:17)
#25 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#26 _CustomizedZone.runUnary (dart:async/zone.dart:667)
#27 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#28 _Future._propagateToListeners (dart:async/future_impl.dart:571)
#29 _Future._completeWithValue (dart:async/future_impl.dart:331)
#30 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#31 _rootRun (dart:async/zone.dart:723)
#32 _ZoneDelegate.run (dart:async/zone.dart:453)
#33 _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:119:43)
#34 VmTurnZone._finishTurn (package:angular/core/zone.dart:146:34)
#35 VmTurnZone._onRunBase (package:angular/core/zone.dart:106:43)
#36 _onRun (package:angular/core/zone.dart:112:17)
#37 _ZoneDelegate.run (dart:async/zone.dart:453)
#38 _CustomizedZone.run (dart:async/zone.dart:663)
#39 VmTurnZone.run (package:angular/core/zone.dart:235:40)
#40 Application.run (package:angular/application.dart:171:20)
#41 main (http://localhost/main.dart:52:11)
EDIT:
I changed my main function to:
void main() {
applicationFactory()
.run();
}
and I am still getting the bind(RouteProvider) error.
The Closure call with mismatched arguments error goes away if I comment out the bind(NgRoutingUsePushState, ...) line.
Inject list without toFactory is deprecated. Use toInstanceOf: Type|Key instead
I guess toInstanceOf isn't appropriate because it takes a type instead of an instance. I would try toValue instead of toFactory
For the mismatched arguments error, you have to remove the _ parameter in the anonymous func:
bind(NgRoutingUsePushState, toFactory: () => new NgRoutingUsePushState.value(false));
I'm still investigating the other issue, which I also have. I'll let you know when I find it.

Resources