Flutter-Bounty-Hunters / static_shock

A static site generator for Dart.
MIT License
142 stars 6 forks source link

bug: [static_shock_docs] Throws on generation #143

Open dickermoshe opened 5 months ago

dickermoshe commented 5 months ago

Running dart run in the static_shock_docs project results in the following error:

Unhandled exception:
NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: []("flutter-bounty-hunters")
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      getItem (package:jinja/src/defaults.dart:23:18)
#2      Context.item (package:jinja/src/context.dart:66:31)
#3      StringSinkRenderer.visitItem (package:jinja/src/renderer.dart:321:20)
#4      Item.accept (package:jinja/src/nodes/expressions.dart:498:20)
#5      StringSinkRenderer.visitAttribute (package:jinja/src/renderer.dart:225:28)
#6      Attribute.accept (package:jinja/src/nodes/expressions.dart:540:20)
#7      StringSinkRenderer.visitFor (package:jinja/src/renderer.dart:520:34)
#8      For.accept (package:jinja/src/nodes/statements.dart:55:20)
#9      StringSinkRenderer.visitOutput (package:jinja/src/renderer.dart:714:12)
#10     Output.accept (package:jinja/src/nodes.dart:109:20)
#11     Template.renderTo (package:jinja/src/environment.dart:569:10)
#12     Template.render (package:jinja/src/environment.dart:556:5)
#13     JinjaPageRenderer._renderJinjaTemplate (package:static_shock/src/plugins/jinja.dart:241:37)
#14     JinjaPageRenderer.renderContent (package:static_shock/src/plugins/jinja.dart:116:5)
#15     StaticShock._renderPages (package:static_shock/src/static_shock.dart:520:28)
<asynchronous suspension>
#16     StaticShock.generateSite (package:static_shock/src/static_shock.dart:227:5)
<asynchronous suspension>
#17     main (file:///C:/Users/dicke/static_shock/packages/static_shock_docs/bin/static_shock_docs.dart:42:3)
<asynchronous suspension>

I'm working on a new plugin, having a working example project to test with would be nice

dickermoshe commented 5 months ago

I see you've opened an issue here https://github.com/ykmnkmi/jinja.dart/issues/27

Guess we'll just have to wait for an error message

matthew-carroll commented 4 months ago

These kinds of errors come up with a lot with minor configuration issues when using Jinja templates. It's often something like you expect that a variable exists but it doesn't. I see a reference to "flutter-bounty-hunters" in your error message.

I would recommend that you look for wherever that value appears in one of the Jinja files.