toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() => {
      'name': name,
      'columns': columns.map((c) => c.toJson()).toList(),
      'constraints': constraints.map((c) => c.toJson()).toList(),
      'rows': rows.map((r) => r.map(storageToJsonValue).toList()).toList(),
      'indexes': indexDefs.values
          .map((d) => {
                'name': d.name,
                'column': d.column,
                'unique': d.unique,
                if (d.columns.length > 1) 'columns': d.columns,
                if (d.collations.any((c) => c.toUpperCase() != 'BINARY'))
                  'collations': d.collations,
                if (d.whereSql != null) 'where': d.whereSql,
                if (d.exprSql != null) 'expr': d.exprSql,
              })
          .toList(),
      'autoInc': autoInc,
      if (withoutRowid) 'withoutRowid': true,
    };