title: Dart/Flutter ffi (Foreign Function Interface) native callbacks eg: sqlite3_exec
body: <p>Hello I am using dart:ffi to build an interface with my native c/c++ library.
  and I needed a way to get a callback from c to dart as an example in sqlite:</p>
  
  <pre><code>int sqlite3_exec(
      sqlite3*,                                  /* An open database */
      const char *sql,                           /* SQL to be evaluated */
      int (*callback)(void*,int,char**,char**),  /* Callback function */
      void *,                                    /* 1st argument to callback */
      char **errmsg                              /* Error msg written here */
  );
  </code></pre>
  
  <p>the third parameter in <code>sqlite3_exec</code> is function pointer to a callback.
  so if I called this function in dart using <code>ffi</code> I need to pass a function pointer: and in <code>dart:ffi</code> <code>Pointer</code> class there is a function named <code>fromFunction</code> witch accepts a dart static function and an <code>exceptionalReturn</code>; but just by calling this function to get the function pointer of a dart managed function: a <code>(sigterm)</code> is raised and the dart code no long work in the process.</p>
  
  <p>So My Question: Is there any way to get a native callback in dart, as in Python, c#, ..</p>
  
  <p>Extra:
  Is there any way to include <code>dartino</code> in a <code>flutter</code> project, since this <a href="https://dartino.github.io/api/dart-dartino.ffi/ForeignDartFunction/ForeignDartFunction.html" rel="noreferrer">ForeignDartFunction</a> covers what I need.</p>