agent-workspace / flutter /packages /flutter_tools /templates /plugin_ffi /src.tmpl /projectName.c.tmpl
agent-workspace / flutter /packages /flutter_tools /templates /plugin_ffi /src.tmpl /projectName.c.tmpl
Download flutter/packages/flutter_tools/templates/plugin_ffi/src.tmpl/projectName.c.tmpl from luom2645/agent-workspace: direct link, hf CLI and curl.
- Browser
- Download file 816 Bytes
-
https://huggingface.co/luom2645/agent-workspace/resolve/main/flutter/packages/flutter_tools/templates/plugin_ffi/src.tmpl/projectName.c.tmpl
- Command line
-
hf download hf://luom2645/agent-workspace/flutter/packages/flutter_tools/templates/plugin_ffi/src.tmpl/projectName.c.tmpl
-
curl -L -o projectName.c.tmpl https://huggingface.co/luom2645/agent-workspace/resolve/main/flutter/packages/flutter_tools/templates/plugin_ffi/src.tmpl/projectName.c.tmpl
816 Bytes
| // A very short-lived native function. | |
| // | |
| // For very short-lived functions, it is fine to call them on the main isolate. | |
| // They will block the Dart execution while running the native function, so | |
| // only do this for native functions which are guaranteed to be short-lived. | |
| FFI_PLUGIN_EXPORT int sum(int a, int b) { return a + b; } | |
| // A longer-lived native function, which occupies the thread calling it. | |
| // | |
| // Do not call these kind of native functions in the main isolate. They will | |
| // block Dart execution. This will cause dropped frames in Flutter applications. | |
| // Instead, call these native functions on a separate isolate. | |
| FFI_PLUGIN_EXPORT int sum_long_running(int a, int b) { | |
| // Simulate work. | |
| Sleep(5000); | |
| usleep(5000 * 1000); | |
| return a + b; | |
| } | |