| 1234567891011121314151617181920212223 |
- import 'package:flutter/scheduler.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- class ToastUtil {
- ToastUtil._();
- static void showToast(String? msg,
- {Duration? displayTime,
- SmartToastType? displayType = SmartToastType.normal,
- bool? addPostFrame}) {
- if (msg != null) {
- if (SchedulerBinding.instance.schedulerPhase != SchedulerPhase.idle) {
- SmartDialog.showToast(msg,
- displayType: displayType, displayTime: displayTime);
- } else {
- SchedulerBinding.instance.addPostFrameCallback((_) {
- SmartDialog.showToast(msg,
- displayType: displayType, displayTime: displayTime);
- });
- }
- }
- }
- }
|