formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions

View File

@ -29,7 +29,7 @@ class SceneApi {
debugPrint('create scene response: $response');
return response;
} on DioException catch (e) {
String errorMessage =
final String errorMessage =
e.response?.data['error']['message'][0] ?? 'something went wrong';
throw APIException(errorMessage);
}
@ -52,7 +52,7 @@ class SceneApi {
debugPrint('create automation response: $response');
return response;
} on DioException catch (e) {
String errorMessage =
final String errorMessage =
e.response?.data['error']['message'][0] ?? 'something went wrong';
throw APIException(errorMessage);
}
@ -63,7 +63,7 @@ class SceneApi {
path: ApiEndpoints.getIconScene,
showServerMessage: false,
expectedResponseModel: (json) {
List<IconModel> iconsList = [];
final iconsList = <IconModel>[];
json.forEach((element) {
iconsList.add(IconModel.fromJson(element));
});
@ -89,8 +89,8 @@ class SceneApi {
expectedResponseModel: (json) {
final scenesJson = json['data'] as List;
List<ScenesModel> scenes = [];
for (var scene in scenesJson) {
final scenes = <ScenesModel>[];
for (final scene in scenesJson) {
scenes.add(ScenesModel.fromJson(scene, isAutomation: false));
}
return scenes;
@ -114,8 +114,8 @@ class SceneApi {
.replaceAll('{projectId}', projectId),
showServerMessage: false,
expectedResponseModel: (json) {
List<ScenesModel> scenes = [];
for (var scene in json) {
final scenes = <ScenesModel>[];
for (final scene in json) {
scenes.add(ScenesModel.fromJson(scene, isAutomation: true));
}
return scenes;
@ -158,7 +158,8 @@ class SceneApi {
}
//update Scene
static updateScene(CreateSceneModel createSceneModel, String sceneId) async {
static Future updateScene(
CreateSceneModel createSceneModel, String sceneId) async {
try {
final response = await _httpService.put(
path: ApiEndpoints.updateScene.replaceAll('{sceneId}', sceneId),
@ -170,14 +171,14 @@ class SceneApi {
);
return response;
} on DioException catch (e) {
String errorMessage =
final String errorMessage =
e.response?.data['error']['message'][0] ?? 'something went wrong';
throw APIException(errorMessage);
}
}
//update automation
static updateAutomation(CreateAutomationModel createAutomationModel,
static Future updateAutomation(CreateAutomationModel createAutomationModel,
String automationId, String projectId) async {
try {
final response = await _httpService.put(
@ -192,7 +193,7 @@ class SceneApi {
);
return response;
} on DioException catch (e) {
String errorMessage =
final String errorMessage =
e.response?.data['error']['message'][0] ?? 'something went wrong';
throw APIException(errorMessage);
}
@ -226,7 +227,7 @@ class SceneApi {
);
return response;
} on DioException catch (e) {
String errorMessage =
final String errorMessage =
e.response?.data['error']['message'][0] ?? 'something went wrong';
throw APIException(errorMessage);
}
@ -247,7 +248,7 @@ class SceneApi {
);
return response;
} on DioException catch (e) {
String errorMessage =
final String errorMessage =
e.response?.data['error']['message'][0] ?? 'something went wrong';
throw APIException(errorMessage);
}
@ -295,8 +296,8 @@ class SceneApi {
.replaceAll('{projectId}', projectId),
showServerMessage: false,
expectedResponseModel: (json) {
List<ScenesModel> scenes = [];
for (var scene in json) {
final scenes = <ScenesModel>[];
for (final scene in json) {
scenes.add(ScenesModel.fromJson(scene));
}
return scenes;