getCurrentIndicesForFunds method
Get the current indices for the given fellowship, template and optional state
fellowship
A String label of the fellowship to get the indices for
template
A String label of the template to get the indices for
someState
The optional state index of the indices. If not provided, the next state index for the given fellowship
and template pair will be used
Returns the indices for the given fellowship, template and optional state if possible. Else null
Implementation
@override
m.Indices? getCurrentIndicesForFunds(
String fellowship, String template, int? someState) {
final fellowshipResult = fellowshipsStore.findFirstSync(_instance,
finder: Finder(filter: Filter.equals("name", fellowship)));
final templateResult = templatesStore.findFirstSync(_instance,
finder: Finder(filter: Filter.equals("name", template)));
if (fellowshipResult != null && templateResult != null) {
final x = fellowshipResult["x"]! as int;
final y = templateResult["y"]! as int;
final cartesianResult = cartesiansStore.findFirstSync(_instance,
finder: Finder(
filter: Filter.and([
Filter.equals("x", x),
Filter.equals("y", y),
Filter.equals("z", someState ?? 0),
]),
));
if (cartesianResult != null) {
final z = (cartesianResult["z"]! as int) + 1;
return m.Indices(x: x, y: y, z: z);
} else {
return m.Indices(x: x, y: y, z: 1);
}
}
return null;
}