serializeToList method

  1. @override
String serializeToList(
  1. String expression,
  2. DartType resolvedGenericType,
  3. bool isExpressionNullable
)

convert the given expression for serialization. The expression is dart code that evaluates to your custom iterable type. you need to return an expression that evaluates to a Dart list

Note: you don't need to implement this if your type implements Iterable. you can throw an exception , this method will never be called in that case

example for kt_dart:

  @override
  String serializeToList(
      String expression, DartType type, bool isExpressionNullable) {
    final optionalQuestion = isExpressionNullable ? '?' : '';
    return expression + optionalQuestion + '.iter.toList()';
  }

Implementation

@override
String serializeToList(String expression, DartType resolvedGenericType,
    bool isExpressionNullable) {
  // not needed as IList implements Iterable
  throw UnimplementedError();
}