toJson method

  1. @override
String? toJson(
  1. Alignment? object
)

Implementation

@override
String? toJson(Alignment? object) {
  if (object == null) return null;

  if (object.x == Alignment.bottomCenter.x &&
      object.y == Alignment.bottomCenter.y) {
    return 'bottomCenter';
  }
  if (object.x == Alignment.bottomLeft.x &&
      object.y == Alignment.bottomLeft.y) {
    return 'bottomLeft';
  }
  if (object.x == Alignment.bottomRight.x &&
      object.y == Alignment.bottomRight.y) {
    return 'bottomRight';
  }

  if (object.x == Alignment.center.x && object.y == Alignment.center.y) {
    return 'center';
  }
  if (object.x == Alignment.centerLeft.x &&
      object.y == Alignment.centerLeft.y) {
    return 'centerLeft';
  }
  if (object.x == Alignment.centerRight.x &&
      object.y == Alignment.centerRight.y) {
    return 'centerRight';
  }

  if (object.x == Alignment.topCenter.x &&
      object.y == Alignment.topCenter.y) {
    return 'topCenter';
  }
  if (object.x == Alignment.topLeft.x && object.y == Alignment.topLeft.y) {
    return 'topLeft';
  }
  if (object.x == Alignment.topRight.x && object.y == Alignment.topRight.y) {
    return 'topRight';
  }

  throw 'Json_Unsuported_Value';
}