TetherColumnInfo.fromJson constructor

TetherColumnInfo.fromJson(
  1. Map<String, dynamic> json
)

Creates a TetherColumnInfo instance from a JSON map (deserialization). Handles missing fields from older data formats with default values.

Implementation

factory TetherColumnInfo.fromJson(Map<String, dynamic> json) {
  final originalName =
      json['originalName'] as String? ?? json['name'] as String;
  return TetherColumnInfo(
    name: json['name'] as String,
    originalName: originalName,
    localName:
        json['localName'] as String? ?? _makeSafeDartIdentifier(originalName),
    type: json['type'] as String,
    isNullable: json['isNullable'] as bool,
    isPrimaryKey: json['isPrimaryKey'] as bool,
    isUnique: json['isUnique'] as bool,
    defaultValue: json['defaultValue'] as String?,
    comment: json['comment'] as String?,
    isIdentity:
        json['isIdentity'] as bool? ??
        false, // <<< ADDED TO fromJson with default
  );
}