I have a dart class which contains a Function member variable (which is different for each instance of the class). I need to store instances of this class in a database (such as ObjectBox), but in order to do so, I have to convert the Function to something that ObjectBox can handle.
I have seen that (using isolates) I could store the function as a string and then execute the string in a similar manner to JS eval(), but this feels like it is prone to errors and I'm hoping there's a better way of storing an actual function (not to mention isolates only working in JIT mode).
I can't see any obvious way to do this, but I'm hoping somebody here knows something I don't!
Aucun commentaire:
Enregistrer un commentaire