MyService<T> class
服务注册类,用于注册GetX服务
支持同步和异步服务初始化:
- 同步服务:使用
service参数 - 异步服务:使用
asyncService参数
示例:
// 同步服务
MyService<SettingsService>(service: () => SettingsService())
// 异步服务(需要异步初始化,如从数据库/网络加载配置)
MyService<ChatService>(asyncService: () async => ChatService())
Constructors
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerService(
) → Future< void> - 注册服务到GetX依赖注入系统
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited