dialog_service 1.0.0 dialog_service: ^1.0.0 copied to clipboard
Dialog Service for handling error dialogs from controllers
Features #
Push Dialog from Controller classes or classes without access to context. Useful for error dialogs. .
Usage #
import 'package:flutter/material.dart';
import 'package:dialog_service/dialog_service.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, child) => Navigator.withDialogManager(child),
// Add your app routes or home
);
}
}
class AppController {
final DialogService _dialogService = DialogService();
void doSomething(){
try {
didSomethingWithError();
} catch(e){
_dialogService.pushDialog(builder: (context)=> ErrorDialog());
}
}
}