File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,28 @@ class AssetPicker extends StatelessWidget {
127127 }
128128 }
129129
130+ /// Register observe callback with assets changes.
131+ /// 注册资源(图库)变化的监听回调
132+ static void registerObserve ([ValueChanged <MethodCall > callback]) {
133+ try {
134+ PhotoManager .addChangeCallback (callback);
135+ PhotoManager .startChangeNotify ();
136+ } catch (e) {
137+ realDebugPrint ('Error when registering assets callback: $e ' );
138+ }
139+ }
140+
141+ /// Unregister observe callback with assets changes.
142+ /// 取消注册资源(图库)变化的监听回调
143+ static void unregisterObserve ([ValueChanged <MethodCall > callback]) {
144+ try {
145+ PhotoManager .removeChangeCallback (callback);
146+ PhotoManager .stopChangeNotify ();
147+ } catch (e) {
148+ realDebugPrint ('Error when unregistering assets callback: $e ' );
149+ }
150+ }
151+
130152 /// Whether the current platform is Apple OS.
131153 /// 当前平台是否苹果系列系统 (iOS & MacOS)
132154 bool get isAppleOS => Platform .isIOS || Platform .isMacOS;
You can’t perform that action at this time.
0 commit comments