[dart/en] add FFI examples#5428
Open
alycda wants to merge 4 commits intoadambard:masterfrom
Open
Conversation
Added comprehensive FFI documentation covering: - Loading C libraries across platforms (Windows/macOS/Linux) - Calling C functions from Dart - Working with C structs using ffi.Struct - Pointer manipulation and array handling - C string conversion (UTF-8) - FFI callbacks for C->Dart function calls - Memory management best practices - Complete C to Dart type mapping reference Also updated Further Reading section with FFI resources. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Enhanced FFI documentation with production-ready patterns: - Opaque pointers for encapsulating C struct internals - Output parameters pattern (pointer-to-pointer technique) - Error handling with C return codes and Dart exceptions - Finalizers for automatic garbage collection cleanup - Multiple DynamicLibrary loading strategies - FFI wrapper class pattern with dispose and state validation These examples are based on real-world patterns from dart-libkv and demonstrate professional FFI development practices including proper resource lifecycle management and idiomatic Dart wrappers around C APIs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
vendethiel
reviewed
Nov 20, 2025
| import "dart:collection"; | ||
| import "dart:math" as math; | ||
| import "dart:ffi" as ffi; | ||
| import "dart:io" show Platform; |
Collaborator
There was a problem hiding this comment.
please add an explanation for show
alycda
commented
Nov 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[language/lang-code](example[python/fr]for Python in French or[java]for multiple Java translations)