From b3a305b4b3d491b3b2e8f1f64ada7c714531d99b Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 23 Aug 2023 15:04:49 +0800 Subject: [PATCH] throw exception on setMaterialColor failure --- lib/filament_controller.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/filament_controller.dart b/lib/filament_controller.dart index 28811e32..dbb81af1 100644 --- a/lib/filament_controller.dart +++ b/lib/filament_controller.dart @@ -401,9 +401,9 @@ class FilamentController { await _channel.invokeMethod("setTexture", [_assetManager, asset]); } - void setMaterialColor(FilamentEntity asset, String meshName, + Future setMaterialColor(FilamentEntity asset, String meshName, int materialIndex, Color color) async { - await _channel.invokeMethod("setMaterialColor", [ + var result = await _channel.invokeMethod("setMaterialColor", [ _assetManager, asset, meshName, @@ -415,6 +415,9 @@ class FilamentController { color.alpha.toDouble() / 255.0 ] ]); + if (!result) { + throw Exception("Failed to set material color"); + } } void transformToUnitCube(FilamentEntity asset) async {