showInCenter static method

void showInCenter({
  1. required String text,
  2. required BuildContext context,
  3. Duration? duration,
})

显示在中间。如不设置duration则会自动根据内容长度来计算(更友好,最长5秒)

Implementation

static void showInCenter(
    {required String text,
    required BuildContext context,
    Duration? duration}) {
  show(
    text,
    context,
    duration: duration,
    gravity: ToastGravity.center,
  );
}