loadArtboard function
Loads the Artboard from the specified Rive File.
When artboardName
is not null it returns the artboard with the specified
name, an assertion is triggered if no artboard with that name exists in the
file.
Implementation
Future<Artboard> loadArtboard(
FutureOr<RiveFile> file, {
String? artboardName,
}) async {
final loaded = await file;
if (artboardName == null) {
return loaded.mainArtboard.instance();
} else {
final artboard = loaded.artboardByName(artboardName)?.instance();
assert(
artboard != null,
'No artboard with the specified name exists in the RiveFile',
);
return artboard!;
}
}