Created
July 23, 2019 14:00
-
-
Save drexel-ue/03062f439de1fceba98b4d28ddbfbef4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Controller | |
import 'package:trivia_black/model/point.dart'; | |
import 'package:trivia_black/trivia_black.dart'; | |
class PointController extends ResourceController { | |
PointController(this.context); | |
ManagedContext context; | |
@Operation.post('identifier') | |
Future<Response> updateScore( | |
@Bind.path('identifier') String identifier) async { | |
final query = Query<Point>(context) | |
..where((Point p) => p.identifier).equalTo(identifier); | |
Point point = await query.fetchOne(); | |
point.scored = true; | |
final update = Query<Point>(context, values: point) | |
..where((Point p) => p.identifier = point.identifier); // erroring on this line | |
point = await update.updateOne(); | |
return Response.ok(point); | |
} | |
} | |
ERROR | |
2019-07-23 09:59:49.451744 | |
[SEVERE] aqueduct: POST /point/f08cc3bc-0ae0-4c46-85b1-eb9529b399fa 4398ms 500 {user-agent : Dart/2.5 (dart:io)\ncontent-type : application/JSON\naccept-encoding : gzip\ncontent-length : 0\nhost : 192.168.1.65:8888\nauthorization : Bearer r1L7RQOb259KXVIFvm9wDtrpEGzeTxZD\n} NoSuchMethodError: The getter 'length' was called on null. | |
Receiver: null | |
Tried calling: length | |
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5) | |
#1 _PostgresQuery&Object&QueryMixin.where | |
package:aqueduct/…/query/mixin.dart:71 | |
#2 PointController.updateScore | |
package:trivia_black/controller/point_controller.dart:16 | |
<asynchronous suspension> | |
#3 _LocalInstanceMirror._invoke (dart:mirrors-patch/mirrors_impl.dart:327:37) | |
#4 _LocalInstanceMirror.invoke (dart:mirrors-patch/mirrors_impl.dart:323:25) | |
#5 BoundOperation.invoke | |
package:aqueduct/…/resource_controller_internal/controller.dart:24 | |
#6 ResourceController._process | |
package:aqueduct/…/http/resource_controller.dart:371 | |
<asynchronous suspension> | |
#7 ResourceController.handle | |
package:aqueduct/…/http/resource_controller.dart:138 | |
<asynchronous suspension> | |
#8 Controller.receive | |
package:aqueduct/…/http/controller.dart:174 | |
<asynchronous suspension> | |
#9 _ControllerRecycler.receive | |
package:aqueduct/…/http/controller.dart:402 | |
#10 Controller.receive | |
package:aqueduct/…/http/controller.dart:206 | |
<asynchronous suspension> | |
#11 Controller.receive | |
package:aqueduct/…/http/controller.dart:206 | |
<asynchronous suspension> | |
#12 Router.receive | |
package:aqueduct/…/http/router.dart:139 | |
<asynchronous suspension> | |
#13 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10) | |
#14 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11) | |
#15 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7) | |
#16 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11) | |
#17 _MapStream._handleData (dart:async/stream_pipe.dart:232:10) | |
#18 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:164:13) | |
#19 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10) | |
#20 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11) | |
#21 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7) | |
#22 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19) | |
#23 _StreamController._add (dart:async/stream_controller.dart:640:7) | |
#24 _StreamController.add (dart:async/stream_controller.dart:586:5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment