fromJson static method
Parses one entry of ext.nylo.commands.list.
Implementation
static LiveCommandSchema? fromJson(Object? json) {
if (json is! Map) return null;
final Object? name = json['name'];
if (name is! String || name.isEmpty) return null;
final Object? description = json['description'];
final Object? options = json['options'];
return LiveCommandSchema(
name: name,
description: description is String && description.isNotEmpty
? description
: null,
options: options is List
? options
.map(LiveCommandOption.fromJson)
.whereType<LiveCommandOption>()
.toList()
: const [],
);
}