diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ab919ef --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ + +name: Build + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + + - name: Install dependencies + run: dart pub get + + - name: Check format + run: dart format --set-exit-if-changed lib/ + + - name: Analyze code + run: dart analyze lib/ + + - name: Build example app + run: | + cd example/ + flutter build web --release diff --git a/README.md b/README.md index 02fe8ec..f56c432 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,67 @@ - +## About the Project -TODO: Put a short description of the package here that helps potential users -know whether this package might be useful for them. +The `fal_client` is a robust and user-friendly library designed for seamless integration of fal serverless functions in Dart and Flutter projects. Developed in pure Dart, it provides developers with simple APIs to interact with AI models and works across all supported Flutter platforms. -## Features +## Getting Started -TODO: List what your package can do. Maybe include images, gifs, or videos. +The `fal_client` library serves as a client for fal serverless Python functions. For guidance on creating your functions, refer to the [quickstart guide](https://fal.ai/docs). -## Getting started +### Client Library -TODO: List prerequisites and provide or point to information on how to -start using the package. +This client library is crafted as a lightweight layer atop platform standards like `http` and `cross_file`. This ensures a hassle-free integration into your existing codebase. Moreover, it addresses platform disparities, guaranteeing flawless operation across various Flutter runtimes. -## Usage +> **Note:** +> Ensure you've reviewed the [fal-serverless getting started guide](https://fal.ai/docs) to acquire your credentials and register your functions. -TODO: Include short and useful examples for package users. Add longer examples -to `/example` folder. +1. Start by adding `fal_client` as a dependency: + +```sh +flutter pub add fal_client +``` + +2. Setup the client instance: + +```dart +import 'package:fal_client/client.dart'; + +final fal = FalClient.withCredentials("FAL_KEY_ID:FAL_KEY_SECRET"); +``` + +3. Now use `fal.subcribe` to dispatch requests to the model API: ```dart -const like = 'sample'; +final result = await fal.subscribe('text-to-image', input: { + 'prompt': 'a cute shih-tzu puppy', + 'model_name': 'stabilityai/stable-diffusion-xl-base-1.0', +}); ``` -## Additional information +The result type is a `Map` and the entries depend on the API output schema. Types in Python are mapped to their corresponding types in Dart. Check [fal.ai/models](https://fal.ai/models) for all available model APIs. + +## Roadmap + +See the [open feature requests](https://github.com/fal-ai/serverless-client-dart/labels/enhancement) for a list of proposed features and join the discussion. + +## Contributing + +Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. + +1. Make sure you read our [Code of Conduct](https://github.com/fal-ai/serverless-client-dart/blob/main/CODE_OF_CONDUCT.md) +2. Fork the project and clone your fork +3. Setup the local environment with `npm install` +4. Create a feature branch (`git checkout -b feature/add-cool-thing`) or a bugfix branch (`git checkout -b fix/smash-that-bug`) +5. Commit the changes (`git commit -m 'feat(client): added a cool thing'`) - use [conventional commits](https://conventionalcommits.org) +6. Push to the branch (`git push --set-upstream origin feature/add-cool-thing`) +7. Open a Pull Request + +Check the [good first issue queue](https://github.com/fal-ai/serverless-client-dart/labels/good+first+issue), your contribution will be welcome! + +## License -TODO: Tell users more about the package: where to find more information, how to -contribute to the package, how to file issues, what response they can expect -from the package authors, and more. +Distributed under the MIT License. See [LICENSE](https://github.com/fal-ai/serverless-client-dart/blob/main/LICENSE) for more information. diff --git a/lib/runtime.dart b/lib/runtime.dart index bc19e73..ae890b4 100644 --- a/lib/runtime.dart +++ b/lib/runtime.dart @@ -1,4 +1,3 @@ -import 'package:cross_file/cross_file.dart'; import 'package:platform/platform.dart'; // In Dart, we can use the dart:html library to check for browser-specific features diff --git a/pubspec.yaml b/pubspec.yaml index c1ec8c9..003d753 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,16 +16,10 @@ topics: environment: sdk: '>=3.1.5 <4.0.0' - flutter: '>=1.17.0' dependencies: cross_file: ^0.3.3+6 - flutter: - sdk: flutter http: ^1.1.0 platform: ^3.1.3 dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ^2.0.0