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
Indices? getCurrentIndicesForFunds(
String fellowship, String contract, int? someState) {
final fellowshipResult = fellowshipsStore.findFirstSync(_instance,
finder: Finder(filter: Filter.equals("name", fellowship)));
final contractResult = contractsStore.findFirstSync(_instance,
finder: Finder(filter: Filter.equals("contract", contract)));
if (fellowshipResult != null && contractResult != null) {
final cartesianResult = cartesiansStore.findFirstSync(_instance,
finder: Finder(
filter: Filter.and([
Filter.equals("xFellowship", fellowshipResult["xFellowship"]),
Filter.equals("yContract", contractResult.key),
Filter.equals("zState", someState ?? 0),
]),
));
if (cartesianResult == null) return null;
return Indices(
x: cartesianResult["xFellowship"]! as int,
y: cartesianResult["yContract"]! as int,
z: (cartesianResult["zState"]! as int) + 1,
);
}
return null;
}