Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用此插件导致app崩溃,无响应,卡住 #3

Open
mdddj opened this issue Jan 4, 2021 · 1 comment
Open

使用此插件导致app崩溃,无响应,卡住 #3

mdddj opened this issue Jan 4, 2021 · 1 comment

Comments

@mdddj
Copy link

mdddj commented Jan 4, 2021

我在getxController init函数初始化监听广播

@override
  void onInit() {
    log('D2ImageController 正在初始化...');
    // FBroadcast.instance().register('image_loaded', (value, callback) {
    //   final _val = value as ImageLoadCompleObj;
    //   onLoadComplate(_val.index, _val);
    // });
    cleanAll();
    super.onInit();
    log('D2ImageController 初始化完成');
  }

在widget中使用,逻辑是图片加载完成后通知controller 图片的相关信息

 Widget buildBody(D2ImageController imageController, BuildContext context) {
    return Container(
      child: Padding(
        padding: const EdgeInsets.only(right: 1),
        child: Tools.image(
            key: imageController.keysMap[image],
            url: image,
            completed: (Size size) {
              // log('屏幕宽度:${Get.width},图片:$image \n 尺寸大小:$size');
              final _obj = ImageLoadCompleObj(image, size, index);
              // FBroadcast.instance().broadcast('image_loaded', value: _obj); <<
            }),
      ),
    );
  }

我发现这个代码在debug模式下是没有问题的,能正常使用,但是profile和release模式下就导致app崩溃卡住无响应,注释掉FBroadcast相关操作也能正常运行,所以我估计是插件哪里出现bug了

@chenBingX
Copy link
Member

先看一下是否在 发送广播 和 接收的onLoadComplate 存在导致循环的逻辑哦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants