From f7c22d248058c7724e321fe650be7995986f8faf Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 26 Jun 2024 12:42:13 +0800 Subject: [PATCH] docs: update quickstart --- docs/quickstart.mdx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 40e90624..b9a30a8c 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -70,18 +70,21 @@ class _MyAppState extends State { class _MyAppState extends State { - late ThermionFlutterPlugin _thermionFlutterPlugin;  - late Future _thermionViewer; + ThermionViewer? _thermionViewer; void initState() {    - _thermionFlutterPlugin = ThermionFlutterPlugin(); - _thermionViewer = _thermionFlutterPlugin.initialize(); + _thermionFlutterPlugin.createViewer().then((viewer) { + setState(() { + _thermionViewer = viewer; + }); + }); }    Widget build(BuildContext context) { return Stack(children:[ + if(_thermionViewer != null)     Positioned.fill( child:ThermionWidget( - plugin:_thermionFlutterPlugin + plugin:_thermionViewer!         )      )     ]);  @@ -104,11 +107,12 @@ class _MyAppState extends State { Widget build(BuildContext context) { return Stack(children:[ +     if(_thermionViewer != null)     Positioned.fill( child:ThermionWidget( - plugin:_thermionFlutterPlugin + plugin:_thermionViewer!         )  -     ), +     ), if (!_loaded) Center( child: ElevatedButton(