fromJson static method

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

Implementation

static FDirection fromJson(final Map<String, dynamic> json) {
  try {
    return FDirection(
      direction: Axis.values.firstWhere((e) => e.toString() == json['s']),
      directionTablet:
          Axis.values.firstWhere((e) => e.toString() == json['t']),
      directionDesktop:
          Axis.values.firstWhere((e) => e.toString() == json['d']),
    );
  } catch (e) {
    Logger.printError('Error in FDirection fromJson: $e');
    return const FDirection(
      direction: Axis.vertical,
      directionTablet: Axis.vertical,
      directionDesktop: Axis.vertical,
    );
  }
}