create<T extends SpaceAttribute> static method

T create<T extends SpaceAttribute>({
  1. double? left,
  2. double? top,
  3. double? right,
  4. double? bottom,
})

Create instance a class of SpaceeAttrtibute

Implementation

static T create<T extends SpaceAttribute>({
  final double? left,
  final double? top,
  final double? right,
  final double? bottom,
}) {
  assert(T != SpaceAttribute);
  switch (T) {
    case MarginAttribute:
      return MarginAttribute(
        left: left,
        top: top,
        right: right,
        bottom: bottom,
      ) as T;
    case PaddingAttribute:
      return PaddingAttribute(
        left: left,
        top: top,
        right: right,
        bottom: bottom,
      ) as T;

    default:
      throw Exception('Cannot create SpaceAttribute of $T');
  }
}