fromJson method

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

Populates message fields from JSON

Implementation

void fromJson(Map<String, dynamic> json) {
  __.in_('fromJson');
  try {
    checkInitialized('BaseMessage');
    json.forEach((key, value) {
      if (hasField(key)) {
        setField(key, value);
      }
    });
    __.info('Populated from JSON');
  } catch (e, stackTrace) {
    __.severe('JSON population failed', e, stackTrace);
    if (e is hujFrameworkException) {
      rethrow;
    }
    throw hujFrameworkException(
      message: 'JSON population failed',
      hujType: hujErrorType.framework,
      originalError: e,
    );
  } finally {
    __.out_('fromJson');
  }
}