Skip to content

Commit f0e87ed

Browse files
committed
FIX Variables Warnings
- Remove unused imports and variables in `color_rgb.dart`. - Update the documentation for the `ActionModel` class to provide more details on its functionality.
1 parent e41c533 commit f0e87ed

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

lib/src/api/models/action/action.dart

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,29 @@ enum ActionType {
5454
}
5555
}
5656

57-
/// Holds information about an action to perform on a user interaction.
57+
/// The [ActionModel] class is a representation of an interactive action
58+
/// that a program can execute based on a user's interaction.
59+
///
60+
/// Each [ActionModel] instance contains a specific [ActionType], which
61+
/// determines the type of action that needs to be performed.
62+
///
63+
/// The class supports serialization and deserialization from JSON,
64+
/// allowing for easy storage, retrieval, and transmission of action data.
65+
///
66+
/// It is an abstract class, meant to be subclassed for specific types of actions.
67+
/// The specific action classes are determined by the [ActionType] enumeration.
68+
///
69+
/// This class also implements the Visitor pattern via the [accept] method.
70+
/// This allows for type-specific computations or actions to be performed
71+
/// on an [ActionModel] instance without the need for type checking or casting.
72+
///
73+
/// For example, the [ActionModel] class can represent various types of actions
74+
/// such as navigation, link, submit, setValue, setVariant, setVariable,
75+
/// callFunction, and callApi. Each of these action types can be handled
76+
/// differently based on the requirements of the application.
77+
///
78+
/// This design provides a flexible and extensible way to manage actions
79+
/// in response to user interactions.
5880
abstract class ActionModel with SerializableMixin {
5981
/// Type of the action.
6082
ActionType type;
@@ -86,5 +108,18 @@ abstract class ActionModel with SerializableMixin {
86108
}
87109
}
88110

111+
/// Applies the visitor pattern to this [ActionModel].
112+
///
113+
/// The [accept] function takes a visitor object and calls the appropriate
114+
/// visit method on the visitor, according to the runtime type of this [ActionModel].
115+
/// This allows the visitor to perform computations or actions depending on
116+
/// the specific subclass of [ActionModel] it is dealing with.
117+
///
118+
/// The return value is the result of calling the visit method on the visitor.
119+
/// The visitor is responsible for specifying the return type [R].
120+
///
121+
/// @param visitor The visitor object to apply to this [ActionModel].
122+
///
123+
/// @returns The result of calling the visit method on the visitor.
89124
R? accept<R>(ActionVisitor<R> visitor);
90125
}

lib/src/api/models/color_rgb.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import 'package:equatable/equatable.dart';
88
import 'package:json_annotation/json_annotation.dart';
99

1010
import '../../../codelessly_api.dart';
11-
import '../mixins.dart';
12-
import 'models.dart';
1311

1412
part 'color_rgb.g.dart';
1513

0 commit comments

Comments
 (0)