dart format
This commit is contained in:
@@ -20,9 +20,13 @@ class AutocompleteApi {
|
||||
);
|
||||
final response = await http.get(endpoint, headers: NextcloudOcs.headers());
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
||||
throw Exception(
|
||||
'Api call failed with ${response.statusCode}: ${response.body}',
|
||||
);
|
||||
}
|
||||
final decoded = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
return AutocompleteResponse.fromJson(decoded['ocs'] as Map<String, dynamic>);
|
||||
return AutocompleteResponse.fromJson(
|
||||
decoded['ocs'] as Map<String, dynamic>,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ class AutocompleteResponse {
|
||||
|
||||
AutocompleteResponse(this.data);
|
||||
|
||||
factory AutocompleteResponse.fromJson(Map<String, dynamic> json) => _$AutocompleteResponseFromJson(json);
|
||||
factory AutocompleteResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$AutocompleteResponseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$AutocompleteResponseToJson(this);
|
||||
}
|
||||
|
||||
@@ -22,9 +23,17 @@ class AutocompleteResponseObject {
|
||||
String? subline;
|
||||
String? shareWithDisplayNameUniqe;
|
||||
|
||||
AutocompleteResponseObject(this.id, this.label, this.icon, this.source, this.status,
|
||||
this.subline, this.shareWithDisplayNameUniqe);
|
||||
AutocompleteResponseObject(
|
||||
this.id,
|
||||
this.label,
|
||||
this.icon,
|
||||
this.source,
|
||||
this.status,
|
||||
this.subline,
|
||||
this.shareWithDisplayNameUniqe,
|
||||
);
|
||||
|
||||
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) => _$AutocompleteResponseObjectFromJson(json);
|
||||
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) =>
|
||||
_$AutocompleteResponseObjectFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$AutocompleteResponseObjectToJson(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user