snippets/Flutter.md
2020-10-13 14:39:57 +02:00

31 lines
845 B
Markdown

Flutter
=======
Async Speichern
===============
```
showDialog(context: context, barrierDismissible: false,
builder: (BuildContext context) { return AlertDialog(content: Text("Saving...")); });
await saveToSomething()
Navigator.of(context, rootNavigator: true).pop();
```
Async Laden initial
===================
* Initial nur den Loading Screen anzeigen
* in InitState das async-Laden aufrufen
* darin await LoadFromSomething()
* dann Navigator.pushReplacement zur Home-Route
Assets
======
* Ordner 'assets' anlegen
* in pubspec.yaml -> flutter: -> assets: -> - assets/foobar.jpg auflisten
Lokaler Package-Import
======================
* in pubspec.yaml unter dependencies den Namen des Package, dann den Pfad, z.B.:
dependencies:
myPackage:
path: ../myPackage
* Dann normal importieren, z.B. import"package:myPackage/file123.dart"