chore(example): Update the example
This commit is contained in:
parent
de85bf848d
commit
308f7d93f5
@ -110,11 +110,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
jid: JID.fromString(jidController.text),
|
jid: JID.fromString(jidController.text),
|
||||||
password: passwordController.text,
|
password: passwordController.text,
|
||||||
useDirectTLS: true,
|
useDirectTLS: true,
|
||||||
// If `allowPlainAuth` is `false`, connecting to some
|
|
||||||
// servers will cause apps to hang, and never connect.
|
|
||||||
// The hang is a bug that will be fixed, so when it is,
|
|
||||||
// allowPlainAuth should be set to false.
|
|
||||||
allowPlainAuth: true,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final result = await connection.connect(waitUntilLogin: true);
|
final result = await connection.connect(waitUntilLogin: true);
|
||||||
@ -122,14 +117,14 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
connected = result.isType<bool>() && result.get<bool>();
|
connected = result.isType<bool>() && result.get<bool>();
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
if (result.isType<XmppConnectionError>()) {
|
if (result.isType<XmppError>()) {
|
||||||
logger.severe(result.get<XmppConnectionError>());
|
logger.severe(result.get<XmppError>());
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => AlertDialog(
|
builder: (_) => AlertDialog(
|
||||||
title: const Text('Error'),
|
title: const Text('Error'),
|
||||||
content: Text(result.get<XmppConnectionError>().toString()),
|
content: Text(result.get<XmppError>().toString()),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user