{"id":15008372,"url":"https://github.com/kingwill101/dart_native_socket","last_synced_at":"2026-02-01T02:02:39.708Z","repository":{"id":249403381,"uuid":"831425861","full_name":"kingwill101/dart_native_socket","owner":"kingwill101","description":"Low-level socket and file descriptor operations for Dart applications","archived":false,"fork":false,"pushed_at":"2024-07-20T23:16:44.000Z","size":24,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-26T19:33:10.220Z","etag":null,"topics":["c","dart","dart-package","dartlang","ffi"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kingwill101.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-20T14:09:03.000Z","updated_at":"2025-09-30T04:26:39.000Z","dependencies_parsed_at":"2024-11-18T01:46:55.556Z","dependency_job_id":null,"html_url":"https://github.com/kingwill101/dart_native_socket","commit_stats":null,"previous_names":["kingwill101/dart_native_socket"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kingwill101/dart_native_socket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingwill101%2Fdart_native_socket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingwill101%2Fdart_native_socket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingwill101%2Fdart_native_socket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingwill101%2Fdart_native_socket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingwill101","download_url":"https://codeload.github.com/kingwill101/dart_native_socket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingwill101%2Fdart_native_socket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28964428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T01:25:30.373Z","status":"online","status_checked_at":"2026-02-01T02:00:08.102Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","dart","dart-package","dartlang","ffi"],"created_at":"2024-09-24T19:17:55.017Z","updated_at":"2026-02-01T02:02:39.685Z","avatar_url":"https://github.com/kingwill101.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Native Socket \n\nThe Native Socket Package provides low-level socket and file descriptor operations for Dart applications. It offers functionality not available in Dart's built-in Socket class, allowing direct interaction with file descriptors and Unix domain sockets.\n\n## Features\n\n- Create and manage Unix domain sockets\n- Perform file descriptor operations\n- Send and receive data with attached file descriptors\n- Create anonymous files and temporary files\n- Non-blocking socket operations\n\n## Installation\n\nTo use this package, add `native_socket` as a dependency in your `pubspec.yaml` file:\n\n\u003e **NOTE:** Currently we are unable to publish packages that depend on hooks/build for native dependencies [see issue](https://github.com/dart-lang/pub-dev/pull/7847)\n\n\n```yaml\ndependencies:\n  native_socket: \n      git: \n        url: https://github.com/kingwill101/dart_native_socket\n```\n## Prerequisites\nTo use this package you need to enable the experimental `native-assets` feature\n\n```\ndart --enable-experiment=native-assets run\n```\n\n## Usage\n\n\nCreating a Unix Socket\n\n```dart\nimport 'package:native_socket/native_socket.dart';\n\nvoid main() {\n  final socket = UnixSocket('/path/to/socket');\n  // Use the socket...\n  socket.close();\n}\n\n```\nSending and receiving data\n\n```dart\nimport 'dart:typed_data';\nimport 'package:native_socket/native_socket.dart';\n\nvoid main() {\n  final socket = UnixSocket('/path/to/socket');\n  \n  // Sending data\n  final dataToSend = Uint8List.fromList([1, 2, 3, 4, 5]);\n  socket.send(dataToSend);\n  \n  // Receiving data\n  final receivedData = socket.receive();\n  print('Received: $receivedData');\n  \n  socket.close();\n}\n```\n\nCheck if socket has data available\n\n```dart\nfinal socket = UnixSocket('/run/user/1000/wayland-1');\n  socket.send(Uint8List.fromList([1, 2, 3]));\n\n  if (socket.hasData()) {\n    final data = socket.receive();\n    print(data);\n  }\n\n  socket.close();\n```\n\nWorking with File Descriptors\n\n\n```dart\nimport 'package:native_socket/native_socket.dart';\n\nvoid main() {\n  // Create an anonymous file\n  final fd = createAnonymousFile(1024);\n  \n  // Write to the file descriptor\n  final dataToWrite = Uint8List.fromList([65, 66, 67, 68]); // \"ABCD\"\n  writeToFd(fd, dataToWrite);\n  \n  // Close the file descriptor\n  closeFd(fd);\n}\n```\n\n\n## Contributing\n\nContributions to the Native Socket Package are welcome! Please submit pull requests or open issues on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingwill101%2Fdart_native_socket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingwill101%2Fdart_native_socket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingwill101%2Fdart_native_socket/lists"}