I initialize this with CreateMap() in Initialize and then use it on
B4X:
Sub SetVuexMutation(Module As Object, MutationName As String, Payload As Map)
MutationName = MutationName.ToLowerCase
Dim cb As BANanoObject = BANano.CallBack(Module, MutationName, Array(VuexState, Payload))
VuexMutations.Put(MutationName, cb)
End Sub
In this case you can't, as the .CallBack line is just making a callback definition. I can't see how it is used further in your example, but as this is just a definition, I suspect this would work with dimming a temp variable. (this is only needed because the B4J compiler will complain of the use of an un-dimmed variable).
When the cb is called, it can use the global variable as parameter, although this looks like a weird construction as it would be able to access the vuexState variable anyway. And as vuexState is an object, it is passed byRef, and the result would be the same.
B4X:
Sub SetVuexMutation(Module As Object, MutationName As String, Payload As Map)
MutationName = MutationName.ToLowerCase
Dim tmpState As Map ' dimmed here just because B4J would else give an error in the next line
Dim cb As BANanoObject = BANano.CallBack(Module, MutationName, Array(tmpState, Payload))
VuexMutations.Put(MutationName, cb)
End Sub