Skip to content

SmartDialog.show<T>指定范型为非空类型时,点击空白处关闭弹窗报错 #105

@moxiaov587

Description

@moxiaov587

版本信息

  • Flutter版本:v3.7.0
  • flutter_smart_dialog版本:v4.8.2+3

描述bug

SmartDialog.show<T>指定范型为非空类型时,点击空白处关闭弹窗报错

E/flutter (30979): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'FutureOr<bool>'
E/flutter (30979): #0      _AsyncCompleter.complete (dart:async/future_impl.dart:36:41)
E/flutter (30979): #1      MainDialog._handleAwaitOver
main_dialog.dart:183
E/flutter (30979): #2      MainDialog.dismiss
main_dialog.dart:207
E/flutter (30979): <asynchronous suspension>
E/flutter (30979): #3      CustomDialog._closeSingle
custom_dialog.dart:396
E/flutter (30979): <asynchronous suspension>

问题demo

void _show() async {
    SmartDialog.show<bool>(builder: (_) { // 添加范型并指定为bool
      return Container(
        height: 80,
        width: 180,
        decoration: BoxDecoration(
          color: Colors.black,
          borderRadius: BorderRadius.circular(10),
        ),
        alignment: Alignment.center,
        child: Text(
          'easy custom dialog',
          style: TextStyle(color: Colors.white),
        ),
      );
    });
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions