Mild fixes to issues I noticed on push

This commit is contained in:
Pyrex 2023-09-05 20:12:33 -07:00
parent 4bbf42db88
commit 9ac4b45422
2 changed files with 3 additions and 17 deletions

View File

@ -1,16 +1,3 @@
# dartterm # dartterm
A new Flutter project. Roguelike stuff in Dart.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -7,7 +6,7 @@ class Assets {
final Map<String, ui.Image> _loaded = {}; final Map<String, ui.Image> _loaded = {};
final Set<String> _waiting = {}; final Set<String> _waiting = {};
Future<ui.Image> getImageAsync(String name) async { Future<ui.Image> _getImageAsync(String name) async {
final assetImageByteData = await rootBundle.load(name); final assetImageByteData = await rootBundle.load(name);
final codec = final codec =
await ui.instantiateImageCodec(assetImageByteData.buffer.asUint8List()); await ui.instantiateImageCodec(assetImageByteData.buffer.asUint8List());
@ -20,7 +19,7 @@ class Assets {
ui.Image? getImageIfAvailable(String name) { ui.Image? getImageIfAvailable(String name) {
if (!_waiting.contains(name)) { if (!_waiting.contains(name)) {
_waiting.add(name); _waiting.add(name);
getImageAsync(name); _getImageAsync(name);
} }
return _loaded[name]; return _loaded[name];
} }