valueCommands property

List<Command> valueCommands
final

Implementation

static final List<Command> valueCommands = [
  Command(
    prefix: '\$',
    command: '\[\]',
    callback: (DartDeclaration self, String testSubject, {required String key, dynamic value}) {
      var typeName = testSubject.substring(3).split('/').last.split('\\').last.toCamelCase();
      var toImport = testSubject.substring(3);
      self.addImport(toImport);
      self.type = 'List<${typeName.toTitleCase()}>';
      return self;
    },
  ),
  Command(
    prefix: '\$',
    notprefix: '\$\[\]',
    callback: (DartDeclaration self, String testSubject, {required String key, dynamic value}) {
      self.setName(key);

      var typeName = testSubject.substring(1).split('/').last.split('\\').last.toCamelCase();

      var toImport = testSubject.substring(1);
      self.addImport(toImport);
      var type = typeName.toTitleCase();

      self.type = type;

      return self;
    },
  ),
  Command(
    prefix: '\@',
    command: 'datetime',
    notprefix: '\$\[\]',
    callback: (DartDeclaration self, String testSubject, {required String key, dynamic value}) {
      self.setName(key);
      self.type = 'DateTime';
      return self;
    },
  ),
  Command(
    prefix: '\@',
    command: 'enum',
    notprefix: '\$\[\]',
    callback: (DartDeclaration self, String testSubject, {required String key, dynamic value}) {
      self.setEnumValues((value as String).substring('@enum:'.length).split(','));
      self.setName(key);
      return self;
    },
  ),
  Command(
    type: dynamic,
    callback: (DartDeclaration self, dynamic testSubject, {required String key, dynamic value}) {
      self.setName(key);

      if (value == null) {
        self.type = 'dynamic';
        return self;
      }
      if (value is Map) {
        self.type = key.toTitleCase();
        self.nestedClasses.add(JsonModel.fromMap('nested', value as Map<String, dynamic>));
        return self;
      }
      self.type = value.runtimeType.toString();
      return self;
    },
  ),
];