I'm having a lot of "NoSuchMethodError: ''" errors.
I have a big web application with angular. Now I'm using dart 2.6.1.
First I had a case in which I defined a static const variable (Ex. static Duration period = Duration(seconds: 30); ).
Using this variable caused that error. Removing the const keyword, everything seemed to work fine.
But then I got the same error from an angular component..
I have a lot of dependencies and I'm afraid that this is causing some strange problems to the compiler.
Any hint?
I don't know if there is a memory limit for const variables, in that case how could I check that limit (or increase it)?
There something that I could do to verify what's the problem?
The following is a part of the stack trace:
Error_handler: reason NoSuchMethodError: '<Unexpected Null Value>'
method not found
Receiver: null
Arguments: [], exception, NoSuchMethodError: '<Unexpected Null Value>'
method not found
Receiver: null
Arguments: [], stack dart:sdk_internal createTimer
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 210:25 [_createTimer]
dart:sdk_internal new
package:angular_components/material_popup/material_popup.dart 510:25 [_onPopupOpened]
package:angular_components/material_popup/material_popup.dart 472:11 <fn>
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 144:18 <fn>
dart:sdk_internal runUnary
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 141:18 [_runUnary]
dart:sdk_internal add
package:angular_components/material_popup/material_popup.dart 862:29 <fn>
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 144:18 <fn>
dart:sdk_internal runUnary
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 141:18 [_runUnary]
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 144:18 <fn>
dart:sdk_internal runUnary
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 141:18 [_runUnary]
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18 <fn>
dart:sdk_internal run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18 [_run]
dart:sdk_internal <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 117:11 <fn>
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18 <fn>
dart:sdk_internal run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18 [_run]
dart:sdk_internal listen
package:angular_components/material_popup/material_popup.dart 468:50 [_open]
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18 <fn>
dart:sdk_internal run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18 [_run]
dart:sdk_internal <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 117:11 <fn>
package:stack_trace <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18 <fn>
dart:sdk_internal run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18 [_run]
dart:sdk_internal scheduleMicrotask
package:angular_components/material_popup/material_popup.dart 338:9 set visible
Edit 1:
I moved back to 2.5.2 and everything has worked fine.
Then I installed 2.6.1 and the problem arose again.
So, I believe that is something related to 2.6.1
Related
I have a weird error showing up when sending a post request.
// this map is passed to a function
final Map<String, dynamic> activityData = {
"userId": 1,
"name": activityName.text,
"description": activityDescription.text,
"startAt": activityStartAt.text,
"endsAt": activityEndAt.text,
"lat": _latitude,
"long": _longitude,
"category": 2,
"status": "pending"
};
// this code bellow is inside a async function
final http.Response response =
await http.post(Uri.encodeFull(url), body: activityData);
this is the error :
E/flutter (32582): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (32582): type 'int' is not a subtype of type 'String' in type cast
E/flutter (32582): #0 CastMap.forEach.<anonymous closure> (dart:_internal/cast.dart:286:25)
E/flutter (32582): #1 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:370:8)
E/flutter (32582): #2 CastMap.forEach (dart:_internal/cast.dart:285:13)
E/flutter (32582): #3 mapToQuery (package:http/src/utils.dart:17:7)
E/flutter (32582): #4 Request.bodyFields= (package:http/src/request.dart:128:17)
E/flutter (32582): #5 BaseClient._sendUnstreamed (package:http/src/base_client.dart:163:17)
E/flutter (32582): <asynchronous suspension>
E/flutter (32582): #6 BaseClient.post (package:http/src/base_client.dart:54:7)
E/flutter (32582): #7 post.<anonymous closure> (package:http/http.dart:70:16)
E/flutter (32582): #8 _withClient (package:http/http.dart:166:20)
E/flutter (32582): <asynchronous suspension>
E/flutter (32582): #9 post (package:http/http.dart:69:5)
E/flutter (32582): #10 _MainModel&Model&ConnectedModel&UsersModel&ActivitiesModel.createActivity (package:activmap/scoped-models/connectedModel.dart:62:15)
E/flutter (32582): <asynchronous suspension>
E/flutter (32582): #11 _NewActivityState.save (package:activmap/pages/newActivity.dart:271:11)
E/flutter (32582): <asynchronous suspension>
E/flutter (32582): #12 _NewActivityState.build.<anonymous closure> (package:activmap/pages/newActivity.dart:248:30)
E/flutter (32582): #13 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
E/flutter (32582): #14 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30)
E/flutter (32582): #15 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (32582): #16 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter (32582): #17 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
E/flutter (32582): #18 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (32582): #19 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (32582): #20 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (32582): #21 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:180:19)
E/flutter (32582): #22 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
E/flutter (32582): #23 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
E/flutter (32582): #24 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (32582): #25 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter (32582): #26 _invoke1 (dart:ui/hooks.dart:168:13)
E/flutter (32582): #27 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
I have it working fine on another screen the only difference that I can see is that the one that's working only have Strings, while this one has int, double and String.
To fix your issue you just have to encode the data before sending.
import 'dart:convert';
...
final http.Response response =
await http.post(Uri.encodeFull(url), body: json.encode(activityData));
If your API doesn't support JSON, then you just have to pass all your data as String.
final Map<String, dynamic> activityData = {
"user_id": "1",
"name": activityName.text,
"description": activityDescription.text,
"startAt": activityStartAt.text,
"endsAt": activityEndAt.text,
"lat": "$_latitude",
"long": "$_longitude",
"category": "2",
"status": "pending"
};
final http.Response response =
await http.post(Uri.encodeFull(url), body: activityData);
Step 1: use "content-type": "application/json" in header
Step 2: encode your body like
jsonEncode( {"param1": 10, "param2":20,"param3": "abc","param4": true})
Example Code Like
headers: {
"content-type": "application/json",
},
body:jsonEncode( {
"qualificationId": 10,
"year":2001,
"instituteName": "example",
"isActive": true
})
Check out requests - a flutter library to make http requests (inspired by python requests module)
Posting application/x-www-form-urlencoded:
var r = await Requests.post(
"https://reqres.in/api/users", body: {
"userId": 10,
"id": 91,
"title": "aut amet sed",
},
bodyEncoding: RequestBodyEncoding.FormURLEncoded);
r.raiseForStatus();
dynamic json = r.json();
print(json['id']);
Posting application/json:
var r = await Requests.post("https://reqres.in/api/users", json: {
"userId": 10,
"id": 91,
"title": "aut amet sed",
"body": "libero voluptate eveniet aperiam sed\nsunt placeat suscipit molestias\nsimilique fugit nam natus\nexpedita consequatur consequatur dolores quia eos et placeat",
});
r.raiseForStatus();
dynamic body = r.json();
print(json['id']);
For flutter version 2.0.6 and http dart package ^0.13.3, you will need to parse the URL and encode your payload using json.encode from the dart:convert library like so:
import 'package:http/http.dart' as http;
import 'dart:convert';
-------
var url = Uri.parse('http://10.0.2.2:8000/api/test');
var response = await http.post(url, body: json.encode({ 'name': 'mac', 'password': 'test' }));
print(response.body);
I have the following code where I work with a map generated from the json.decode() function:
for (var i = 0; i < data[0]["conversation"].length; i++) {
print(data[0]["conversation"][i]["conversationID"]);
print(data[0]["conversation"][i]["startDate"]);
print(data[0]["conversation"][i]["lastActivity"]);
print(data[0]["conversation"][i]["messageCount"]);
for (var j = 0; j < int.parse( data[0]["conversation"][i]["messageCount"] ); j++) {
print(data[0]["conversation"][i]["messages"]["message"][j]);
}
print("\n");
}
in the most external "for" everything works well, the problem is in the internal "for" where I receive an error when trying to access a value:
for (var j = 0; j < int.parse( data[0]["conversation"][i]["messageCount"] ); j++) {
print(data[0]["conversation"][i]["messages"]["message"][j]["body"]);
}
This is the error:
E/flutter ( 1650): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter ( 1650): NoSuchMethodError: The method '[]' was called on null.
E/flutter ( 1650): Receiver: null
E/flutter ( 1650): Tried calling: []("body")
E/flutter ( 1650): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter ( 1650): #1 ChatScreenState.obtenerMensajesArchivados (file:///home/fenrir/Documents/api/lib/chat/chat_page.dart:115:67)
E/flutter ( 1650): <asynchronous suspension>
E/flutter ( 1650): #2 ChatScreenState.initState.<anonymous closure> (file:///home/fenrir/Documents/api/lib/chat/chat_page.dart:157:7)
E/flutter ( 1650): #3 _RootZone.runUnary (dart:async/zone.dart:1379:54)
E/flutter ( 1650): #4 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter ( 1650): #5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
E/flutter ( 1650): #6 Future._propagateToListeners (dart:async/future_impl.dart:671:32)
E/flutter ( 1650): #7 Future._complete (dart:async/future_impl.dart:476:7)
E/flutter ( 1650): #8 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 1650): #9 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
E/flutter ( 1650): #10 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 1650): #11 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
Example of
data[0]["conversation"][i]["messages"]["message"][j] :
{conversationID: 230, from: 123#localhost, to: 456#localhost, sentDate: 2018-10-18T12:48:05.039Z, body: aloha, roomEvent: false}
print(data[0]["conversation"][i]["messages"]["message"][j].runtimeType); return:
_InternalLinkedHashMap<String, dynamic>
I do not know what the error may be since in the first "for" it works for me but in the second one it does not :(
The error is using ["body"] on null, so for some j value, data[0]["conversation"][i]["messages"]["message"][j] must be null.
Try finding the i and j that makes this throw, then check that the "message" listthe expected number of elements, and that none of them are null.
I'm learning streams/bloc pattern in dart/flutter and can't pinpoint where the error is coming from when I try to run my app. I assume the stream is getting hung up somewhere judging by the async errors. I am usingdispose() and closing out the streams inside it. Any help would be appreciated.
Here is the code. I put it all in one big chunk but commented which file each of the code chunks is from:
// bloc.dart
import 'dart:async';
import 'validators.dart';
class Bloc extends Validators {
final _email = new StreamController<String>();
final _password = new StreamController<String>();
// Add data to stream
Stream<String> get email => _email.stream.transform(validateEmail);
Stream<String> get password => _password.stream.transform(validatePassword);
// Change Data
Function(String) get changeEmail => _email.sink.add;
Function(String) get changePassword => _password.sink.add;
dispose() {
_email.close();
_password.close();
}
}
final bloc = Bloc();
// login_screen.dart
import 'package:flutter/material.dart';
import '../blocs/bloc.dart';
class LoginScreen extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(20.0),
child: Column(
children: [
emailField(),
passwordField(),
Container(
margin: EdgeInsets.only(top: 25.0),
),
raisedButton()
],
));
}
Widget emailField() {
return StreamBuilder(
stream: bloc.email,
builder: (context, snapshot) {
return TextField(
onChanged: bloc.changeEmail,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
hintText: 'ardon#exampl.com',
labelText: 'Enter your email!',
errorText: snapshot.error),
);
});
}
Widget passwordField() {
return TextField(
obscureText: true,
decoration: InputDecoration(hintText: 'password', labelText: 'password'),
);
}
Widget raisedButton() {
return RaisedButton(
child: Text('Login'),
color: Colors.blue,
onPressed: () {},
);
}
}
// validation.dart
import 'dart:async';
class Validators {
final validateEmail =
StreamTransformer<String, String>.fromHandlers(handleData: (email, sink) {
if (email.contains('#')) {
sink.add(email);
} else {
sink.addError('Please enter valid email');
}
});
final validatePassword = StreamTransformer<String, String>.fromHandlers(
handleData: (password, sink) {
if (password.length > 4) {
sink.add(password);
} else {
sink.addError('Please enter the right number of characters');
}
});
}
Here is the error I am getting when I try to hot restart my app:
⣯[VERBOSE-2:shell.cc(181)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
[VERBOSE-2:engine.cc(158)] Could not prepare to run the isolate.
[VERBOSE-2:engine.cc(117)] Engine not prepare and launch isolate.
Error -32000 received from application: Could not run configuration in engine.
JSON-RPC error -32000: Could not run configuration in engine.
package:json_rpc_2/src/client.dart 110:64 Client.sendRequest
package:json_rpc_2/src/peer.dart 68:15 Peer.sendRequest
package:flutter_tools/src/vmservice.dart 293:13 VMService._sendRequest
package:flutter_tools/src/vmservice.dart 842:12 VM.invokeRpcRaw
===== asynchronous gap ===========================
package:flutter_tools/src/vmservice.dart 865:49 VM.invokeRpc
===== asynchronous gap ===========================
package:flutter_tools/src/vmservice.dart 932:12 VM.runInView
package:flutter_tools/src/vmservice.dart 1439:20 FlutterView.runFromSource
===== asynchronous gap ===========================
package:flutter_tools/src/run_hot.dart 379:18 HotRunner._launchInView
===== asynchronous gap ===========================
package:flutter_tools/src/run_hot.dart 390:13 HotRunner._launchFromDevFS
===== asynchronous gap ===========================
package:flutter_tools/src/run_hot.dart 442:11 HotRunner._restartFromSources
===== asynchronous gap ===========================
package:flutter_tools/src/run_hot.dart 505:15 HotRunner.restart
===== asynchronous gap ===========================
package:flutter_tools/src/run_hot.dart 282:44 HotRunner.handleTerminalCommand
===== asynchronous gap ===========================
package:flutter_tools/src/resident_runner.dart 754:15 ResidentRunner.processTerminalInput
===== asynchronous gap ===========================
dart:async/zone.dart 1132:38 _rootRunUnary
dart:async/zone.dart 1029:19 _CustomZone.runUnary
dart:async/zone.dart 931:7 _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 336:11 _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 263:7 _BufferingStreamSubscription._add
dart:async/broadcast_stream_controller.dart 379:20 _SyncBroadcastStreamController._sendData
dart:async/broadcast_stream_controller.dart 254:5 _BroadcastStreamController.add
dart:async/broadcast_stream_controller.dart 480:11 _AsBroadcastStreamController.add
dart:async/zone.dart 1132:38 _rootRunUnary
dart:async/zone.dart 1029:19 _CustomZone.runUnary
dart:async/zone.dart 931:7 _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 336:11 _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 263:7 _BufferingStreamSubscription._add
dart:async/stream_transformers.dart 68:11 _SinkTransformerStreamSubscription._add
dart:async/stream_transformers.dart 15:11 _EventSinkWrapper.add
dart:convert/string_conversion.dart 268:11 _StringAdapterSink.add
dart:convert/string_conversion.dart 273:7 _StringAdapterSink.addSlice
dart:convert/string_conversion.dart 348:20 _Utf8ConversionSink.addSlice
dart:convert/ascii.dart 278:17 _ErrorHandlingAsciiDecoderSink.addSlice
dart:convert/ascii.dart 264:5 _ErrorHandlingAsciiDecoderSink.add
dart:convert/chunked_conversion.dart 86:18 _ConverterStreamEventSink.add
dart:async/stream_transformers.dart 120:24 _SinkTransformerStreamSubscription._handleData
dart:async/zone.dart 1132:38 _rootRunUnary
dart:async/zone.dart 1029:19 _CustomZone.runUnary
dart:async/zone.dart 931:7 _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 336:11 _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 263:7 _BufferingStreamSubscription._add
dart:async/stream_controller.dart 763:19 _SyncStreamController._sendData
dart:async/stream_controller.dart 639:7 _StreamController._add
dart:async/stream_controller.dart 585:5 _StreamController.add
dart:io/runtime/binsocket_patch.dart 1714:41 _Socket._onData
dart:async/zone.dart 1136:13 _rootRunUnary
dart:async/zone.dart 1029:19 _CustomZone.runUnary
dart:async/zone.dart 931:7 _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 336:11 _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 263:7 _BufferingStreamSubscription._add
dart:async/stream_controller.dart 763:19 _SyncStreamController._sendData
dart:async/stream_controller.dart 639:7 _StreamController._add
dart:async/stream_controller.dart 585:5 _StreamController.add
dart:io/runtime/binsocket_patch.dart 1276:33 new _RawSocket.<fn>
dart:io/runtime/binsocket_patch.dart 819:14 _NativeSocket.issueReadEvent.issue
dart:async/schedule_microtask.dart 41:21 _microtaskLoop
dart:async/schedule_microtask.dart 50:5 _startMicrotaskLoop
dart:isolate/runtime/libisolate_patch.dart 115:13 _runPendingImmediateCallback
dart:isolate/runtime/libisolate_patch.dart 172:5 _RawReceivePortImpl._handleMessage
edit: When I do a hot reload instead of a hot restart, I get this error:
Initializing hot reload... ⣟Hot reload failed: type 'TimeoutException' is not a subtype of type 'Map<String, dynamic>'
#0 HotRunner._reloadSources.<anonymous closure> (package:flutter_tools/src/run_hot.dart:587:45)
#1 _rootRunUnary (dart:async/zone.dart:1132:38)
#2 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#3 _FutureListener.handleError (dart:async/future_impl.dart:147:20)
#4 Future._propagateToListeners.handleError (dart:async/future_impl.dart:654:47)
#5 Future._propagateToListeners (dart:async/future_impl.dart:675:24)
#6 Future._completeError (dart:async/future_impl.dart:494:5)
#7 Future.wait.handleError (dart:async/future.dart:379:18)
#8 _rootRunBinary (dart:async/zone.dart:1144:38)
#9 _CustomZone.runBinary (dart:async/zone.dart:1037:19)
#10 _FutureListener.handleError (dart:async/future_impl.dart:143:20)
#11 Future._propagateToListeners.handleError (dart:async/future_impl.dart:654:47)
#12 Future._propagateToListeners (dart:async/future_impl.dart:675:24)
#13 Future._completeError (dart:async/future_impl.dart:494:5)
#14 _SyncCompleter._completeError (dart:async/future_impl.dart:55:12)
#15 _Completer.completeError (dart:async/future_impl.dart:27:5)
#16 _AsyncAwaitCompleter.completeError (dart:async/runtime/libasync_patch.dart:40:18)
#17 Isolate.reloadSources (package:flutter_tools/src/vmservice.dart)
<asynchronous suspension>
#18 FlutterDevice.reloadSources (package:flutter_tools/src/resident_runner.dart:144:66)
#19 HotRunner._reloadSources (package:flutter_tools/src/run_hot.dart:579:67)
<asynchronous suspension>
#20 HotRunner.restart (package:flutter_tools/src/run_hot.dart:520:24)
<asynchronous suspension>
#21 HotRunner.handleTerminalCommand (package:flutter_tools/src/run_hot.dart:282:44)
<asynchronous suspension>
#22 ResidentRunner.processTerminalInput (package:flutter_tools/src/resident_runner.dart:754:15)
<asynchronous suspension>
#23 _rootRunUnary (dart:async/zone.dart:1132:38)
#24 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#25 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#26 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#27 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#28 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:379:20)
#29 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:254:5)
#30 _AsBroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:480:11)
#31 _rootRunUnary (dart:async/zone.dart:1132:38)
#32 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#33 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#34 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#35 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#36 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#37 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#38 _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
#39 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
#40 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
#41 _ErrorHandlingAsciiDecoderSink.addSlice (dart:convert/ascii.dart:278:17)
#42 _ErrorHandlingAsciiDecoderSink.add (dart:convert/ascii.dart:264:5)
#43 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
#44 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#45 _rootRunUnary (dart:async/zone.dart:1132:38)
#46 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#47 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#48 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#49 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#50 _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
#51 _StreamController._add (dart:async/stream_controller.dart:639:7)
#52 _StreamController.add (dart:async/stream_controller.dart:585:5)
#53 _Socket._onData (dart:io/runtime/binsocket_patch.dart:1714:41)
#54 _rootRunUnary (dart:async/zone.dart:1136:13)
#55 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#56 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#57 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#58 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#59 _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
#60 _StreamController._add (dart:async/stream_controller.dart:639:7)
#61 _StreamController.add (dart:async/stream_controller.dart:585:5)
#62 new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1276:33)
#63 _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:819:14)
#64 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#65 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#66 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#67 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
A case where you'll frequently run into this is if you're building your own engine from source, and using it via flutter's --local-engine option.
Dart code in a Flutter app is initially compiled through the Dart kernel compiler, which emits a .dill file in an intermediate format. This intermediate format includes an identifier that the Dart VM in the Flutter engine uses to validate that it's compatible with that VM version. The root cause of an Invalid kernel binary format version error message is that the .dill file in question was generated with an incompatible version of the kernel compiler.
To resolve this, after rebuilding the engine for your device (e.g. android_debug_unopt), you'll want to ensure that you've also rebuilt the associated host toolchain (e.g. host_debug_unopt).
If you're seeing this in other cases, it's almost certainly a bug, and I'd definitely encourage you to open an issue against Flutter.
There was a bug fixed very recently that resulted in this error message https://github.com/flutter/flutter/issues/21348
I would expect this to be included in the latest Flutter dev and master channel.
To switch to the dev channel use
flutter channel dev
flutter doctor
update
(from https://github.com/flutter/flutter/issues/22964#issuecomment-429071970)
import './src/app.dart'; in lib/main.dart is the culprit.
lib/main.dart must not contain relative imports and must not be imported from other files
https://github.com/dart-lang/sdk#33076
was just fixed but it will take a while until it lands in Flutter.
I get this error when searching for results. Spent hours now to debug, but can't discover what the issue might be. Must be some deserialisation issue, when trying to assign the id to the Place object. But I'm no JavaScript expert (thats why I want to use dart). But of course the files are converted into JavaScript, and the Developer Tools debugger then references to the generated JS files.
The strange thing is that it was working with my mock backend. But it's not working with the Aqueduct backend. Aqueduct itself is providing the right output.
[{"id":1,"name":"Easyhotel"},{"id":2,"name":"Hotel Greulich"}]
Fetching a list of all objects is working. Seems only to be related to the search method.
Any hint would be appreciated.
Version
Dart VM version: 2.0.0-dev.68.0 (Tue Jul 10 14:47:26 2018 +0200) on "macos_x64"
pubspec.yaml
name: places
description: Cool Places
version: 0.0.1
environment:
sdk: '>=2.0.0-dev.66.0 <2.0.0'
dependencies:
angular: ^5.0.0-beta
angular_forms: ^2.0.0-beta
angular_router: ^2.0.0-alpha
http: ^0.11.0
stream_transform: ^0.0.6
angular_components: ^0.9.0-alpha+15
dev_dependencies:
sass_builder: ^2.0.0
angular_test: ^2.0.0-beta
build_runner: ^0.9.0
build_test: ^0.10.2
build_web_compilers: ^0.4.0
test: ^1.0.0
place_search_service.dart
import 'dart:async';
import 'dart:convert';
import 'package:angular/angular.dart';
import 'package:http/http.dart';
import 'package:places/src/place/place.dart';
#Injectable()
class PlaceSearchService {
final Client _http;
PlaceSearchService(this._http);
Future<List<Place>> search(String term) async {
try {
final response = await _http.get('http://localhost:8888/places?name=$term');
return (_extractData(response) as List)
.map((json) => new Place.fromJson(json))
.toList();
} catch (e) {
throw _handleError(e);
}
}
dynamic _extractData(Response resp) => json.decode(resp.body)['data'];
Exception _handleError(dynamic e) {
print(e); // for demo purposes only
return new Exception('Server error; cause: $e');
}
}
place.dart
class Place {
final int id;
String name;
Place(this.id, this.name);
factory Place.fromJson(Map<String, dynamic> place) =>
new Place(_toInt(place['id']), place['name']);
Map toJson() => {'id': id, 'name': name};
}
int _toInt(id) => id is int ? id : int.parse(id);
Stacktrace from Chrome Dev Tools
`dart_sdk.js:101652 EXCEPTION: Exception: Server error; cause: Type 'String' is not a subtype of expected type 'int'.
STACKTRACE:
packages/$sdk/dev_compiler/amd/dart_sdk.js 4835:29 throw
packages/places/src/place/place_search_service.ddc.js 28:21 search
packages/$sdk/dev_compiler/amd/dart_sdk.js 23385:33 onValue
packages/stack_trace/stack_trace.ddc.js 142:98 .dart.fn
packages/stack_trace/stack_trace.ddc.js 188:16 [_run]
packages/stack_trace/stack_trace.ddc.js 142:80 arg
packages/angular/src/core/zone/ng_zone.ddc.js 117:18 arg
packages/$sdk/dev_compiler/amd/dart_sdk.js 29365:56 _rootRunUnary
packages/$sdk/dev_compiler/amd/dart_sdk.js 28991:14 runUnary
packages/angular/src/core/zone/ng_zone.ddc.js 114:21 [_runUnary]
packages/$sdk/dev_compiler/amd/dart_sdk.js 29193:14 runUnary
packages/$sdk/dev_compiler/amd/dart_sdk.js 25288:29 handleValue
packages/$sdk/dev_compiler/amd/dart_sdk.js 25750:49 handleValueCallback
packages/$sdk/dev_compiler/amd/dart_sdk.js 25780:17 _propagateToListeners
packages/$sdk/dev_compiler/amd/dart_sdk.js 25643:23 [_completeWithValue]
packages/$sdk/dev_compiler/amd/dart_sdk.js 25661:35 .scheduleMicrotask.dart.fn
packages/angular/src/core/zone/ng_zone.ddc.js 92:11 safeMicrotask
packages/stack_trace/stack_trace.ddc.js 188:16 [_run]
packages/stack_trace/stack_trace.ddc.js 137:71 parent.registerCallback.dart.fn
packages/angular/src/core/zone/ng_zone.ddc.js 107:18 parent.run.dart.fn
packages/$sdk/dev_compiler/amd/dart_sdk.js 29359:14 _rootRun
packages/$sdk/dev_compiler/amd/dart_sdk.js 28985:14 run
packages/angular/src/core/zone/ng_zone.ddc.js 104:21 [_run]
packages/$sdk/dev_compiler/amd/dart_sdk.js 29186:14 run
packages/$sdk/dev_compiler/amd/dart_sdk.js 29106:14 runGuarded
packages/$sdk/dev_compiler/amd/dart_sdk.js 29142:33 async._AsyncCallbackEntry.new.dart.fn
packages/$sdk/dev_compiler/amd/dart_sdk.js 25990:13 _microtaskLoop
packages/$sdk/dev_compiler/amd/dart_sdk.js 25996:13 _startMicrotaskLoop
packages/$sdk/dev_compiler/amd/dart_sdk.js 26066:11 internalCallback
packages/$sdk/dev_compiler/amd/dart_sdk.js 29214:14 registerUnaryCallback
packages/$sdk/dev_compiler/amd/dart_sdk.js 23396:22 async
packages/places/src/place/place_search_service.ddc.js 23:20 search
packages/places/src/place/place_list_component.ddc.js 69:58 search
packages/$sdk/dev_compiler/amd/dart_sdk.js 23404:34 runBody
packages/$sdk/dev_compiler/amd/dart_sdk.js 23431:7 async
packages/places/src/place/place_list_component.ddc.js 65:20 search
packages/places/src/place/place_list_component.template.ddc.js 158:16 [_handle_click_15_0]
packages/angular/src/bootstrap/modules.ddc.js 1869:106 src__core__linker__app_view_utils.appViewUtils.eventManager.getZone.runGuarded.dart.fn
packages/angular/src/core/zone/ng_zone.ddc.js 107:18 parent.run.dart.fn
packages/$sdk/dev_compiler/amd/dart_sdk.js 29359:14 _rootRun
packages/$sdk/dev_compiler/amd/dart_sdk.js 28985:14 run
packages/angular/src/core/zone/ng_zone.ddc.js 104:21 [_run]
packages/$sdk/dev_compiler/amd/dart_sdk.js 29186:14 run
packages/$sdk/dev_compiler/amd/dart_sdk.js 29106:14 runGuarded
packages/angular/src/core/zone/ng_zone.ddc.js 223:31 runGuarded
packages/angular/src/bootstrap/modules.ddc.js 1869:81 event`
When examining the error object by setting a breakpoint
Symbol(_error)
:
Error at Object.dart.throw (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4835:29) at Object.dart.castError (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4462:15) at Object.dart.as (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4751:17) at Function.check_int [as _check] (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:9997:17) at Object.dart._checkApply (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4572:19) at Object.dart._checkAndCall (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4653:14) at Object.dart.callMethod (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4702:17) at Object.dart.dindex (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4717:17) at src__place__place_search_service.PlaceSearchService.new.[_extractData] (http://localhost:8080/packages/places/src/place/place_search_service.ddc.js:33:19) at src__place__place_search_service.PlaceSearchService.new.search (http://localhost:8080/packages/places/src/place/place_search_service.ddc.js:26:49) at search.next (<anonymous>) at onValue (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:23385:33) at (anonymous function).dart.fn (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:142:98) at src__stack_zone_specification.StackZoneSpecification.new.[_run] (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:188:16) at parent.registerUnaryCallback.dart.fn.arg (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:142:80) at parent.runUnary.dart.fn.arg (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:117:18) at async._rootRunUnary (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29365:56) at async._ZoneDelegate.new.runUnary (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:28991:14) at src__core__zone__ng_zone.NgZone.new.[_runUnary] (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:114:21) at async._CustomZone.new.runUnary (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29193:14) at _FutureListener.then.handleValue (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25288:29) at handleValueCallback (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25750:49) at Function._propagateToListeners (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25780:17) at _Future.new.[_completeWithValue] (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25643:23) at (anonymous function).scheduleMicrotask.dart.fn (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25661:35) at safeMicrotask (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:92:11) at src__stack_zone_specification.StackZoneSpecification.new.[_run] (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:188:16) at parent.registerCallback.dart.fn (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:137:71) at parent.run.dart.fn (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:107:18) at async._rootRun (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29359:14) at async._ZoneDelegate.new.run (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:28985:14) at src__core__zone__ng_zone.NgZone.new.[_run] (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:104:21) at async._CustomZone.new.run (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29186:14) at async._CustomZone.new.runGuarded (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29106:14) at async._AsyncCallbackEntry.new.dart.fn [as callback] (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29142:33) at Object.async._microtaskLoop (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25990:13) at async._startMicrotaskLoop (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25996:13) at MutationObserver.internalCallback (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:26066:11)
stack
:
"Error↵ at Object.dart.throw (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4835:29)↵ at Object.dart.castError (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4462:15)↵ at Object.dart.as (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4751:17)↵ at Function.check_int [as _check] (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:9997:17)↵ at Object.dart._checkApply (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4572:19)↵ at Object.dart._checkAndCall (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4653:14)↵ at Object.dart.callMethod (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4702:17)↵ at Object.dart.dindex (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:4717:17)↵ at src__place__place_search_service.PlaceSearchService.new.[_extractData] (http://localhost:8080/packages/places/src/place/place_search_service.ddc.js:33:19)↵ at src__place__place_search_service.PlaceSearchService.new.search (http://localhost:8080/packages/places/src/place/place_search_service.ddc.js:26:49)↵ at search.next (<anonymous>)↵ at onValue (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:23385:33)↵ at (anonymous function).dart.fn (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:142:98)↵ at src__stack_zone_specification.StackZoneSpecification.new.[_run] (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:188:16)↵ at parent.registerUnaryCallback.dart.fn.arg (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:142:80)↵ at parent.runUnary.dart.fn.arg (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:117:18)↵ at async._rootRunUnary (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29365:56)↵ at async._ZoneDelegate.new.runUnary (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:28991:14)↵ at src__core__zone__ng_zone.NgZone.new.[_runUnary] (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:114:21)↵ at async._CustomZone.new.runUnary (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29193:14)↵ at _FutureListener.then.handleValue (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25288:29)↵ at handleValueCallback (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25750:49)↵ at Function._propagateToListeners (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25780:17)↵ at _Future.new.[_completeWithValue] (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25643:23)↵ at (anonymous function).scheduleMicrotask.dart.fn (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25661:35)↵ at safeMicrotask (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:92:11)↵ at src__stack_zone_specification.StackZoneSpecification.new.[_run] (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:188:16)↵ at parent.registerCallback.dart.fn (http://localhost:8080/packages/stack_trace/stack_trace.ddc.js:137:71)↵ at parent.run.dart.fn (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:107:18)↵ at async._rootRun (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29359:14)↵ at async._ZoneDelegate.new.run (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:28985:14)↵ at src__core__zone__ng_zone.NgZone.new.[_run] (http://localhost:8080/packages/angular/src/core/zone/ng_zone.ddc.js:104:21)↵ at async._CustomZone.new.run (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29186:14)↵ at async._CustomZone.new.runGuarded (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29106:14)↵ at async._AsyncCallbackEntry.new.dart.fn [as callback] (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:29142:33)↵ at Object.async._microtaskLoop (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25990:13)↵ at async._startMicrotaskLoop (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:25996:13)↵ at MutationObserver.internalCallback (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:26066:11)"
With commented out throw _handleError
`dart_sdk.js:101652 EXCEPTION: TypeError: Cannot read property 'Symbol(dartx.length)' of undefined
STACKTRACE:
packages/places/src/place/place_list_component.ddc.js 71:24 search
packages/$sdk/dev_compiler/amd/dart_sdk.js 23385:33 onValue
packages/stack_trace/stack_trace.ddc.js 142:98 .dart.fn
packages/stack_trace/stack_trace.ddc.js 188:16 [_run]
packages/stack_trace/stack_trace.ddc.js 142:80 arg
packages/angular/src/core/zone/ng_zone.ddc.js 117:18 arg
packages/$sdk/dev_compiler/amd/dart_sdk.js 29365:56 _rootRunUnary
packages/$sdk/dev_compiler/amd/dart_sdk.js 28991:14 runUnary
packages/angular/src/core/zone/ng_zone.ddc.js 114:21 [_runUnary]
packages/$sdk/dev_compiler/amd/dart_sdk.js 29193:14 runUnary
packages/$sdk/dev_compiler/amd/dart_sdk.js 25288:29 handleValue
packages/$sdk/dev_compiler/amd/dart_sdk.js 25750:49 handleValueCallback
packages/$sdk/dev_compiler/amd/dart_sdk.js 25780:17 _propagateToListeners
packages/$sdk/dev_compiler/amd/dart_sdk.js 25643:23 [_completeWithValue]
packages/$sdk/dev_compiler/amd/dart_sdk.js 25661:35 .scheduleMicrotask.dart.fn
packages/angular/src/core/zone/ng_zone.ddc.js 92:11 safeMicrotask
packages/stack_trace/stack_trace.ddc.js 188:16 [_run]
packages/stack_trace/stack_trace.ddc.js 137:71 parent.registerCallback.dart.fn
packages/angular/src/core/zone/ng_zone.ddc.js 107:18 parent.run.dart.fn
packages/$sdk/dev_compiler/amd/dart_sdk.js 29359:14 _rootRun
packages/$sdk/dev_compiler/amd/dart_sdk.js 28985:14 run
packages/angular/src/core/zone/ng_zone.ddc.js 104:21 [_run]
packages/$sdk/dev_compiler/amd/dart_sdk.js 29186:14 run
packages/$sdk/dev_compiler/amd/dart_sdk.js 29106:14 runGuarded
packages/$sdk/dev_compiler/amd/dart_sdk.js 29142:33 async._AsyncCallbackEntry.new.dart.fn
packages/$sdk/dev_compiler/amd/dart_sdk.js 25990:13 _microtaskLoop
packages/$sdk/dev_compiler/amd/dart_sdk.js 25996:13 _startMicrotaskLoop
packages/$sdk/dev_compiler/amd/dart_sdk.js 26066:11 internalCallback
packages/$sdk/dev_compiler/amd/dart_sdk.js 29214:14 registerUnaryCallback
packages/$sdk/dev_compiler/amd/dart_sdk.js 23396:22 async
packages/places/src/place/place_list_component.ddc.js 65:20 search
packages/places/src/place/place_list_component.template.ddc.js 158:16 [_handle_click_15_0]
packages/angular/src/bootstrap/modules.ddc.js 1869:106 src__core__linker__app_view_utils.appViewUtils.eventManager.getZone.runGuarded.dart.fn
packages/angular/src/core/zone/ng_zone.ddc.js 107:18 parent.run.dart.fn
packages/$sdk/dev_compiler/amd/dart_sdk.js 29359:14 _rootRun
packages/$sdk/dev_compiler/amd/dart_sdk.js 28985:14 run
packages/angular/src/core/zone/ng_zone.ddc.js 104:21 [_run]
packages/$sdk/dev_compiler/amd/dart_sdk.js 29186:14 run
packages/$sdk/dev_compiler/amd/dart_sdk.js 29106:14 runGuarded
packages/angular/src/core/zone/ng_zone.ddc.js 223:31 runGuarded
packages/angular/src/bootstrap/modules.ddc.js 1869:81 event
error # dart_sdk.js:101652
handle # exceptions.dart:14
call # exceptions.dart:11
handleUncaughtException # application_ref.dart:134
(anonymous function).(anonymous function).(anonymous function).onError.listen.dart.fn.error # application_ref.dart:51
(anonymous function).dart.fn # stack_zone_specification.dart:129
[_run] # stack_zone_specification.dart:209
parent.registerUnaryCallback.dart.fn.arg # stack_zone_specification.dart:129
parent.runUnary.dart.fn.arg # ng_zone.dart:190
async._rootRunUnary # dart_sdk.js:29368
runUnary # dart_sdk.js:28991
[_runUnary] # ng_zone.dart:187
runUnary # dart_sdk.js:29193
runUnaryGuarded # dart_sdk.js:29114
[_sendData] # dart_sdk.js:23973
[_add] # dart_sdk.js:23920
[_sendData] # dart_sdk.js:24605
add # dart_sdk.js:24415
[_onErrorWithLongStackTrace] # ng_zone.dart:228
async._rootRunBinary # dart_sdk.js:29377
runBinary # dart_sdk.js:29579
[_handleUncaughtError] # stack_zone_specification.dart:163
handleUncaughtError # dart_sdk.js:29170
_propagateToListeners # dart_sdk.js:25693
[_completeWithValue] # dart_sdk.js:25643
(anonymous function).scheduleMicrotask.dart.fn # dart_sdk.js:25661
safeMicrotask # ng_zone.dart:163
[_run] # stack_zone_specification.dart:209
parent.registerCallback.dart.fn # stack_zone_specification.dart:119
parent.run.dart.fn # ng_zone.dart:178
async._rootRun # dart_sdk.js:29359
run # dart_sdk.js:28985
[_run] # ng_zone.dart:175
run # dart_sdk.js:29186
runGuarded # dart_sdk.js:29106
dart.fn # dart_sdk.js:29142
async._microtaskLoop # dart_sdk.js:25990
async._startMicrotaskLoop # dart_sdk.js:25996
internalCallback # dart_sdk.js:26066
childList (async)
dart.fn.callback # dart_sdk.js:26076
_scheduleImmediate # dart_sdk.js:26052
async._scheduleAsyncCallback # dart_sdk.js:26010
async._rootScheduleMicrotask # dart_sdk.js:29404
scheduleMicrotask # dart_sdk.js:29028
[_scheduleMicrotask] # ng_zone.dart:171
scheduleMicrotask # dart_sdk.js:29237
[_asyncComplete] # dart_sdk.js:25660
complete # dart_sdk.js:25194
reader.(anonymous function).first.then.dart.fn._ # browser_client.dart:60
(anonymous function).dart.fn # stack_zone_specification.dart:129
[_run] # stack_zone_specification.dart:209
parent.registerUnaryCallback.dart.fn.arg # stack_zone_specification.dart:129
parent.runUnary.dart.fn.arg # ng_zone.dart:190
async._rootRunUnary # dart_sdk.js:29365
runUnary # dart_sdk.js:28991
[_runUnary] # ng_zone.dart:187
runUnary # dart_sdk.js:29193
handleValue # dart_sdk.js:25288
handleValueCallback # dart_sdk.js:25750
_propagateToListeners # dart_sdk.js:25780
[_complete] # dart_sdk.js:25634
async._cancelAndValue # dart_sdk.js:27687
subscription.listen.dart.fn.value # dart_sdk.js:10492
dart._checkAndCall # dart_sdk.js:4656
dart.dcall # dart_sdk.js:4661
(anonymous function).html$._wrapZone.dart.fn.e # dart_sdk.js:99172
(anonymous function).dart.fn # stack_zone_specification.dart:129
[_run] # stack_zone_specification.dart:209
parent.registerUnaryCallback.dart.fn.arg # stack_zone_specification.dart:129
parent.runUnary.dart.fn.arg # ng_zone.dart:190
async._rootRunUnary # dart_sdk.js:29368
runUnary # dart_sdk.js:28991
[_runUnary] # ng_zone.dart:187
runUnary # dart_sdk.js:29193
runUnaryGuarded # dart_sdk.js:29114
dart.fn.arg # dart_sdk.js:29146
load (async)
[_addEventListener] # dart_sdk.js:57186
[dartx.addEventListener] # dart_sdk.js:57176
[_tryResume] # dart_sdk.js:99153
_EventStreamSubscription.new # dart_sdk.js:99173
listen # dart_sdk.js:98974
get first # dart_sdk.js:10491
async.async.xhr.(anonymous function).first.then.dart.fn._ # browser_client.dart:58
(anonymous function).dart.fn # stack_zone_specification.dart:129
[_run] # stack_zone_specification.dart:209
parent.registerUnaryCallback.dart.fn.arg # stack_zone_specification.dart:129
parent.runUnary.dart.fn.arg # ng_zone.dart:190
async._rootRunUnary # dart_sdk.js:29365
runUnary # dart_sdk.js:28991
[_runUnary] # ng_zone.dart:187
runUnary # dart_sdk.js:29193
handleValue # dart_sdk.js:25288
handleValueCallback # dart_sdk.js:25750
_propagateToListeners # dart_sdk.js:25780
[_complete] # dart_sdk.js:25634
async._cancelAndValue # dart_sdk.js:27687
subscription.listen.dart.fn.value # dart_sdk.js:10492
dart._checkAndCall # dart_sdk.js:4656
dart.dcall # dart_sdk.js:4661
(anonymous function).html$._wrapZone.dart.fn.e # dart_sdk.js:99172
(anonymous function).dart.fn # stack_zone_specification.dart:129
[_run] # stack_zone_specification.dart:209
parent.registerUnaryCallback.dart.fn.arg # stack_zone_specification.dart:129
parent.runUnary.dart.fn.arg # ng_zone.dart:190
async._rootRunUnary # dart_sdk.js:29368
runUnary # dart_sdk.js:28991
[_runUnary] # ng_zone.dart:187
runUnary # dart_sdk.js:29193
runUnaryGuarded # dart_sdk.js:29114
dart.fn.arg # dart_sdk.js:29146
load (async)
[_addEventListener] # dart_sdk.js:57186
[dartx.addEventListener] # dart_sdk.js:57176
[_tryResume] # dart_sdk.js:99153
_EventStreamSubscription.new # dart_sdk.js:99173
listen # dart_sdk.js:98974
get first # dart_sdk.js:10491
send # browser_client.dart:52
onValue # dart_sdk.js:23385
(anonymous function).dart.fn # stack_zone_specification.dart:129
[_run] # stack_zone_specification.dart:209
parent.registerUnaryCallback.dart.fn.arg # stack_zone_specification.dart:129
parent.runUnary.dart.fn.arg # ng_zone.dart:190
async._rootRunUnary # dart_sdk.js:29365
runUnary # dart_sdk.js:28991
[_runUnary] # ng_zone.dart:187
runUnary # dart_sdk.js:29193
handleValue # dart_sdk.js:25288
handleValueCallback # dart_sdk.js:25750
_propagateToListeners # dart_sdk.js:25780
[_completeWithValue] # dart_sdk.js:25643
(anonymous function).scheduleMicrotask.dart.fn # dart_sdk.js:25661
safeMicrotask # ng_zone.dart:163
[_run] # stack_zone_specification.dart:209
parent.registerCallback.dart.fn # stack_zone_specification.dart:119
parent.run.dart.fn # ng_zone.dart:178
async._rootRun # dart_sdk.js:29359
run # dart_sdk.js:28985
[_run] # ng_zone.dart:175
run # dart_sdk.js:29186
runGuarded # dart_sdk.js:29106
dart.fn # dart_sdk.js:29142
async._microtaskLoop # dart_sdk.js:25990
async._startMicrotaskLoop # dart_sdk.js:25996
internalCallback # dart_sdk.js:26066
childList (async)
dart.fn.callback # dart_sdk.js:26076
_scheduleImmediate # dart_sdk.js:26052
async._scheduleAsyncCallback # dart_sdk.js:26010
async._rootScheduleMicrotask # dart_sdk.js:29404
scheduleMicrotask # dart_sdk.js:29028
[_scheduleMicrotask] # ng_zone.dart:171
scheduleMicrotask # dart_sdk.js:29237
async.scheduleMicrotask # dart_sdk.js:26048
schedule # dart_sdk.js:26968
[_setPendingEvents] # dart_sdk.js:23798
[_createSubscription] # dart_sdk.js:26927
listen # dart_sdk.js:23656
listen # dart_sdk.js:26156
toBytes # byte_stream.dart:24
send # browser_client.dart:43
runBody # dart_sdk.js:23404
async.async # dart_sdk.js:23431
send # browser_client.dart:42
_sendUnstreamed # base_client.dart:171
runBody # dart_sdk.js:23404
async.async # dart_sdk.js:23431
[_sendUnstreamed] # base_client.dart:152
get # base_client.dart:34
search # place_search_service.dart:16
runBody # dart_sdk.js:23404
async.async # dart_sdk.js:23431
search # place_search_service.dart:14
search # place_list_component.dart:54
runBody # dart_sdk.js:23404
async.async # dart_sdk.js:23431
search # place_list_component.dart:50
[_handle_click_15_0] # place_list_component.template.dart:160
src__core__linker__app_view_utils.appViewUtils.eventManager.getZone.runGuarded.dart.fn # app_view.dart:619
parent.run.dart.fn # ng_zone.dart:178
async._rootRun # dart_sdk.js:29359
run # dart_sdk.js:28985
[_run] # ng_zone.dart:175
run # dart_sdk.js:29186
runGuarded # dart_sdk.js:29106
runGuarded # ng_zone.dart:333
dart.fn.event`
Found the error. Actually in the Mock interface, it was:
dynamic _extractData(Response resp) => json.decode(resp.body)[data];
But in the Aqueduct interface the response is not enclosed in a JSON "data" tag. So changing it to
dynamic _extractData(Response resp) => json.decode(resp.body);
solved my problem.
So when getting an error such as:
TypeError: Cannot read property 'Symbol(dartx.length)' of undefined
it most likely means, that the response might not contain the correct json.
I'm trying to bind a Polymer paper input element to an Angular variable but I get this exception:
No getter for 'focusAction'.
STACKTRACE:
#0 StaticClosureMap.lookupGetter (package:angular/core/parser/static_closure_map.dart:15:25)
#1 DynamicParserBackend.newAccessScope (package:angular/core/parser/dynamic_parser.dart:112:38)
#2 DynamicParserImpl.parseAccessOrCallScope (package:angular/core/parser/dynamic_parser_impl.dart:257:67)
#3 DynamicParserImpl.parsePrimary (package:angular/core/parser/dynamic_parser_impl.dart:239:36)
#4 DynamicParserImpl.parseAccessOrCallMember (package:angular/core/parser/dynamic_parser_impl.dart:193:30)
#5 DynamicParserImpl.parsePrefix (package:angular/core/parser/dynamic_parser_impl.dart:188:37)
#6 DynamicParserImpl.parseMultiplicative (package:angular/core/parser/dynamic_parser_impl.dart:163:29)
#7 DynamicParserImpl.parseAdditive (package:angular/core/parser/dynamic_parser_impl.dart:149:37)
#8 DynamicParserImpl.parseRelational (package:angular/core/parser/dynamic_parser_impl.dart:131:31)
#9 DynamicParserImpl.parseEquality (package:angular/core/parser/dynamic_parser_impl.dart:117:33)
#10 DynamicParserImpl.parseLogicalAnd (package:angular/core/parser/dynamic_parser_impl.dart:108:31)
#11 DynamicParserImpl.parseLogicalOr (package:angular/core/parser/dynamic_parser_impl.dart:99:33)
#12 DynamicParserImpl.parseConditional (package:angular/core/parser/dynamic_parser_impl.dart:83:32)
#13 DynamicParserImpl.parseExpression (package:angular/core/parser/dynamic_parser_impl.dart:68:34)
#14 DynamicParserImpl.parseFormatter (package:angular/core/parser/dynamic_parser_impl.dart:53:33)
#15 DynamicParserImpl.parsePrimary (package:angular/core/parser/dynamic_parser_impl.dart:220:34)
#16 DynamicParserImpl.parseAccessOrCallMember (package:angular/core/parser/dynamic_parser_impl.dart:193:30)
#17 DynamicParserImpl.parsePrefix (package:angular/core/parser/dynamic_parser_impl.dart:188:37)
#18 DynamicParserImpl.parseMultiplicative (package:angular/core/parser/dynamic_parser_impl.dart:163:29)
#19 DynamicParserImpl.parseAdditive (package:angular/core/parser/dynamic_parser_impl.dart:149:37)
#20 DynamicParserImpl.parseRelational (package:angular/core/parser/dynamic_parser_impl.dart:131:31)
#21 DynamicParserImpl.parseEquality (package:angular/core/parser/dynamic_parser_impl.dart:117:33)
#22 DynamicParserImpl.parseLogicalAnd (package:angular/core/parser/dynamic_parser_impl.dart:108:31)
#23 DynamicParserImpl.parseLogicalOr (package:angular/core/parser/dynamic_parser_impl.dart:99:33)
#24 DynamicParserImpl.parseConditional (package:angular/core/parser/dynamic_parser_impl.dart:83:32)
#25 DynamicParserImpl.parseExpression (package:angular/core/parser/dynamic_parser_impl.dart:68:34)
#26 DynamicParserImpl.parseFormatter (package:angular/core/parser/dynamic_parser_impl.dart:53:33)
#27 DynamicParserImpl.parseChain (package:angular/core/parser/dynamic_parser_impl.dart:35:32)
#28 DynamicParser._parse (package:angular/core/parser/dynamic_parser.dart:40:46)
#29 DynamicParser.call.<anonymous closure> (package:angular/core/parser/dynamic_parser.dart:35:50)
#30 _HashMap.putIfAbsent (dart:collection-patch/collection_patch.dart:124)
#31 DynamicParser.call (package:angular/core/parser/dynamic_parser.dart:35:30)
#32 ASTParser.call (package:angular/change_detection/ast_parser.dart:33:22)
#33 DirectiveSelector.matchElement.<anonymous closure>.<anonymous closure> (package:angular/core_dom/selector.dart:109:38)
#34 List.forEach (dart:core-patch/growable_array.dart:228)
#35 DirectiveSelector.matchElement.<anonymous closure> (package:angular/core_dom/selector.dart:106:55)
#36 _AttributeMap.forEach (dart:html:33642)
#37 DirectiveSelector.matchElement (package:angular/core_dom/selector.dart:90:31)
#38 Compiler._elementBinderForNode (package:angular/core_dom/compiler.dart:39:43)
#39 Compiler._compileView (package:angular/core_dom/compiler.dart:129:32)
#40 Compiler._compileNode (package:angular/core_dom/compiler.dart:85:23)
#41 Compiler._compileView (package:angular/core_dom/compiler.dart:128:19)
#42 Compiler._compileNode (package:angular/core_dom/compiler.dart:85:23)
#43 Compiler._compileView (package:angular/core_dom/compiler.dart:128:19)
#44 Compiler.call (package:angular/core_dom/compiler.dart:16:17)
#45 Application.run.<anonymous closure>.<anonymous closure> (package:angular/application.dart:191:47)
#46 _rootRunUnary (dart:async/zone.dart:836)
#47 _ZoneDelegate.runUnary (dart:async/zone.dart:466)
#48 _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:117:63)
#49 VmTurnZone._onRunBase (package:angular/core/zone.dart:99:16)
#50 _onRunUnary (package:angular/core/zone.dart:117:17)
#51 _CustomZone.runUnary (dart:async/zone.dart:748)
#52 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#53 _Future._propagateToListeners (dart:async/future_impl.dart:571)
#54 _Future._completeWithValue (dart:async/future_impl.dart:331)
#55 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#56 _rootRun (dart:async/zone.dart:829)
#57 _ZoneDelegate.run (dart:async/zone.dart:459)
#58 _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:122:45)
#59 VmTurnZone._finishTurn (package:angular/core/zone.dart:152:34)
#60 VmTurnZone._onRunBase (package:angular/core/zone.dart:106:43)
#61 _onRun (package:angular/core/zone.dart:113:17)
#62 _CustomZone.run (dart:async/zone.dart:740)
#63 VmTurnZone.run (package:angular/core/zone.dart:241:40)
#64 Application.run (package:angular/application.dart:180:22)
#65 main.<anonymous closure> (http://localhost:8080/angularpaper.dart:16:190)
#66 _RootZone.run (dart:async/zone.dart:1077)
#67 main (http://localhost:8080/angularpaper.dart:15:7)
The HTML page:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular paper elements binding</title>
<link rel="import" href="packages/polymer/polymer.html">
<link rel="import" href="packages/paper_elements/paper_input.html">
<link rel="stylesheet" href="angularpaper.css">
</head>
<body>
<h1>Angular paper elements binding</h1>
<p>
<label>
Change the value through an ng-model bound input box:
<input type="text" ng-model="curValue">
</label>
<paper-input label="Paper element" bind-value="curValue"></paper-input>
</p>
<script async type="application/dart" src="angularpaper.dart"></script>
<script async src="packages/browser/dart.js"></script>
</body>
</html>
The Dart code:
import 'package:polymer/polymer.dart';
import 'package:angular/application_factory.dart';
// HACK until we fix code gen size. This doesn't really fix it,
// just makes it better.
#MirrorsUsed(override: '*')
import 'dart:mirrors';
void main() {
initPolymer()
.run(() {
applicationFactory().run();
})
;
}
The Yaml file:
name: angularpaper
description: A angular paper elements binding example
dependencies:
angular: 0.14.0
polymer: 0.14.0
paper_elements: 0.2.0
browser: any
dependency_overrides:
args: '>=0.11.0 <0.13.0'
code_transformers: '>=0.2.3 <0.3.0'
html5lib: '>=0.12.0 <0.13.0'
transformers:
- angular
- polymer:
entry_points: web/angularpaper.html