prasule/lib/util/show_message.dart
2024-01-09 00:26:43 +01:00

15 lines
497 B
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
/// Shows either SnackBar on Android or Toast on iOS
Future<void> showMessage(String message, BuildContext context) async {
if (Platform.isIOS) {
await Fluttertoast.showToast(msg: message, toastLength: Toast.LENGTH_LONG);
} else {
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(message)));
}
}