Skip to content

Commit

Permalink
readme added
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Islam committed Nov 2, 2023
1 parent ca55b2a commit c8b16a6
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# camera_linux

A new Flutter FFI plugin project.
Camera Linux is a Flutter FFI plugin designed specifically for the Linux platform. This plugin allows Flutter developers to access and capture images from the Linux camera, seamlessly integrating native code invocation using Dart's FFI.

## Getting Started

This project is a starting point for a Flutter
[FFI plugin](https://docs.flutter.dev/development/platform-integration/c-interop),
a specialized package that includes native code directly invoked with Dart FFI.
Dart FFI Integration: Built on top of Flutter's FFI (Foreign Function Interface) to directly invoke native functions.
Platform-Specific: Tailored for Linux, ensuring optimal performance and compatibility.
Easy Access to Camera: Provides straightforward functions to capture images directly from the Linux camera.

## Project structure

Expand All @@ -18,7 +18,7 @@ This template uses the following structure:
* `lib`: Contains the Dart code that defines the API of the plugin, and which
calls into the native code using `dart:ffi`.

* platform folders (`android`, `ios`, `windows`, etc.): Contains the build files
* platform folder (`linux`): Contains the build files
for building and bundling the native code library with the platform application.

## Building and bundling native code
Expand Down Expand Up @@ -57,23 +57,17 @@ A plugin can have both FFI and method channels:
ffiPlugin: true
```
The native build systems that are invoked by FFI (and method channel) plugins are:
The native build systems that are invoked by FFI (and method channel) plugin is:
* For Android: Gradle, which invokes the Android NDK for native builds.
* See the documentation in android/build.gradle.
* For iOS and MacOS: Xcode, via CocoaPods.
* See the documentation in ios/camera_linux.podspec.
* See the documentation in macos/camera_linux.podspec.
* For Linux and Windows: CMake.
* See the documentation in linux/CMakeLists.txt.
* See the documentation in windows/CMakeLists.txt.
## Binding to native code
To use the native code, bindings in Dart are needed.
To avoid writing these by hand, they are generated from the header file
(`src/camera_linux.h`) by `package:ffigen`.
Regenerate the bindings by running `flutter pub run ffigen --config ffigen.yaml`.
Instead of manually writing the Dart bindings to native code, they are auto-generated from the header file (src/camera_linux.h) using the package:ffigen. To refresh these bindings, execute:
`flutter pub run ffigen --config ffigen.yaml`

## Invoking native code

Expand All @@ -84,9 +78,16 @@ Longer-running functions should be invoked on a helper isolate to avoid
dropping frames in Flutter applications.
For example, see `sumAsync` in `lib/camera_linux.dart`.

## Flutter help
## Getting Started with the Plugin

Add the camera_linux plugin to your pubspec.yaml:

```dependencies:
camera_linux: ^0.1.0
```
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Execute the following command to fetch the package:
`flutter pub get`

## Further Assistance
For comprehensive guidance on Flutter, visit the official documentation, offering tutorials, samples, mobile development insights, and a complete API reference.

0 comments on commit c8b16a6

Please sign in to comment.