パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v6.5.4

posix

OSx および Linux で POSIX API を公開します

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
935万
いいね数
12
Pub ポイント
160

パッケージをインストール

flutter pub add posix

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

posixパッケージはmacOSおよびLinuxでPOSIXシステムAPIへのアクセスを提供し、ファイル操作、プロセス制御、シグナル処理などの低レベルシステム操作を可能にします。下位のオペレーティングシステムとの直接的な相互作用が必要なデスクトップアプリケーション向けに設計されています。Dartインターフェースを通じてネイティブPOSIX関数を公開しており、高度なシステムプログラミングタスクに適しています。このパッケージはmacOS、Linux、Windows、Android、iOSプラットフォームをサポートしていますが、完全なPOSIX機能は主にmacOSとLinuxで利用可能です。システムリソースに対する細かい制御が必要なツールを開発する開発者にとって理想的です。

用途

  • システムレベルのファイル操作
  • プロセスおよびスレッドの管理
  • デスクトップアプリケーションにおけるシグナル処理
  • クロスプラットフォームシステムユーティリティ
  • 低レベルOSインタラクション

主な機能

  • ネイティブ POSIX API へのアクセス
  • macOS および Linux のサポート
  • クロスプラットフォーム互換性
  • システム呼び出し用のDart対応ラッパー
  • 軽量で焦点を絞ったデザイン

適している対象

  • デスクトップアプリケーション開発者
  • システムツール作成者
  • 高度な Flutter ユーザー
  • OSレベルのアクセスが必要な開発者
  • プロセス分離を必要とするツール

注意事項

  • 非POSIXプラットフォームでの機能制限
  • プラットフォーム固有の知識が必要です
  • モバイルアプリのコアロジックには適していません
  • 権限を昇格させる必要がある場合があります
  • デスクトップ環境専用に最適

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Provides Dart access to the POSIX api for MacOS and Linux system.


import 'package:posix/posix.dart';

int uid = getuid();

Contributing

Dart types only

The api should only expose dart types. Any C types MUST be translated to dart types before being returned.

setters and getters

One of the first questsion is to whether we should use Dart's settings and getters:

e.g.


// getuid
int uid = getuid;

or

int uid = getuid();


/// setuid

uid = myuid;

or 

setuid = uid;

or

setuid(uid);

My initial thoughts is to make the api identical to the posix api which would mean that we don't use Dart setters and getters.

error returns

Do we return error no.s or do we throw.

As Dart is a modern language it uses Exception whereas posix returns error codes.

Often posix will return null and then expect you to make a separate call to 'errorno' to get the actual error no.

I'm inclined to bring the api that we expose into the modern world.

So I'm proposing that if an posix api returns an error that we throw a PosixException with a message and error code.

Adding additional functions

The process of adding additional functions is:

  1. Install ffigen
dart pub global activate ffigen
  1. Run the ffigen setup.

The paths may be different on your system. Search for clang-c/Index.h

sudo apt-get install libclang-dev
dart pub run ffigen:setup -I/usr/lib/llvm-11/include -L/usr/lib/llvm-11/lib
  1. find the required posix header file

  2. use ffigen to create the initial dart file from the header.

    • add your header file to ffigen.yaml
  3. Run ffigen

dart pub run ffigen  --config ffigen/linux.yaml 
  1. convert each method to take/return dart types.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト