fromJson static method

BulkUpdateTasksResponse? fromJson(
  1. dynamic value
)

Returns a new BulkUpdateTasksResponse instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static BulkUpdateTasksResponse? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      assert(json.containsKey(r'success'), 'Required key "BulkUpdateTasksResponse[success]" is missing from JSON.');
      assert(json[r'success'] != null, 'Required key "BulkUpdateTasksResponse[success]" has a null value in JSON.');
      assert(json.containsKey(r'affectedCount'), 'Required key "BulkUpdateTasksResponse[affectedCount]" is missing from JSON.');
      assert(json[r'affectedCount'] != null, 'Required key "BulkUpdateTasksResponse[affectedCount]" has a null value in JSON.');
      assert(json.containsKey(r'tasks'), 'Required key "BulkUpdateTasksResponse[tasks]" is missing from JSON.');
      assert(json[r'tasks'] != null, 'Required key "BulkUpdateTasksResponse[tasks]" has a null value in JSON.');
      assert(json.containsKey(r'failed'), 'Required key "BulkUpdateTasksResponse[failed]" is missing from JSON.');
      assert(json[r'failed'] != null, 'Required key "BulkUpdateTasksResponse[failed]" has a null value in JSON.');
      return true;
    }());

    return BulkUpdateTasksResponse(
      success: mapValueOfType<bool>(json, r'success')!,
      affectedCount: mapValueOfType<int>(json, r'affectedCount')!,
      tasks: Task.listFromJson(json[r'tasks']),
      failed: BulkDeleteTasksResponseFailedInner.listFromJson(json[r'failed']),
    );
  }
  return null;
}