LastUsedMethod.fromJson constructor

LastUsedMethod.fromJson(
  1. dynamic data
)

Creates a LastUsedMethod from a dynamic JSON-like object.

Implementation

factory LastUsedMethod.fromJson(dynamic data) {
  final json = DynamicJsonExtension.getJsonMap(data);

  // Safely extract the raw type string from the JSON
  final rawType = json['type'];
  final parsedType = rawType is String
      ? LastUsedMethodTypeExtension.fromString(rawType)
      : null;

  return LastUsedMethod(
    id: json['id'] as String?,
    type: parsedType,
  );
}