@@ -269,10 +269,9 @@ abstract class RendererBase<T extends Object?> {
269
269
270
270
// If this section is not a conditional or repeated section, it is a value
271
271
// section, regardless of type.
272
- var isNullValue = property.isNullValue! ;
273
- if (node.invert && isNullValue (context)) {
272
+ if (node.invert && property.isNullValue (context)) {
274
273
renderBlock (node.children);
275
- } else if (! node.invert && ! isNullValue (context)) {
274
+ } else if (! node.invert && ! property. isNullValue (context)) {
276
275
property.renderValue !(context, this , node.children, sink);
277
276
}
278
277
}
@@ -288,17 +287,17 @@ abstract class RendererBase<T extends Object?> {
288
287
}
289
288
}
290
289
291
- String renderSimple (
292
- Object context, List < MustachioNode > ast, Template template, StringSink sink,
290
+ String renderSimple (Object ? context, List < MustachioNode > ast, Template template,
291
+ StringSink sink,
293
292
{required RendererBase <Object > parent, required Set <String > getters}) {
294
293
var renderer = SimpleRenderer (context, parent, template, sink, getters);
295
294
renderer.renderBlock (ast);
296
295
return renderer.sink.toString ();
297
296
}
298
297
299
- class SimpleRenderer extends RendererBase <Object > {
298
+ class SimpleRenderer extends RendererBase <Object ? > {
300
299
SimpleRenderer (
301
- Object context,
300
+ Object ? context,
302
301
RendererBase <Object > parent,
303
302
Template template,
304
303
StringSink sink,
@@ -356,7 +355,7 @@ class Property<T> {
356
355
final Iterable <void > Function (
357
356
T , RendererBase <T >, List <MustachioNode >, StringSink )? renderIterable;
358
357
359
- final bool Function (T )? isNullValue;
358
+ final bool Function (T ) isNullValue;
360
359
361
360
final void Function (T , RendererBase <T >, List <MustachioNode >, StringSink )?
362
361
renderValue;
@@ -366,8 +365,11 @@ class Property<T> {
366
365
required this .renderVariable,
367
366
this .getBool,
368
367
this .renderIterable,
369
- this .isNullValue,
370
- this .renderValue});
368
+ // TODO(jcollins-g): consider making this required or emitting warnings
369
+ // if called on a non-nullable?
370
+ bool Function (T )? isNullValue,
371
+ this .renderValue})
372
+ : isNullValue = (isNullValue ?? (_) => false );
371
373
372
374
String renderSimpleVariable (
373
375
T c, List <String > remainingNames, String typeString) {
0 commit comments