Build Nitric applications with Dart
The Dart SDK supports the use of the Nitric framework with Dart and Flutter. For more information, check out the main Nitric repo.
Nitric SDKs provide an infrastructure-as-code style that lets you define resources in code. You can also write the functions that support the logic behind APIs, subscribers and schedules.
You can request the type of access you need to resources such as publishing for topics, without dealing directly with IAM or policy documents.
Install the Nitric CLI, then generate your project:
nitric new hello-world dart-starter
First of all, you need to install the library:
dart pub add nitric_sdk
Then you're able to import the library and create cloud resources:
import 'package:nitric_sdk/nitric.dart';
void main() {
final publicApi = Nitric.api("public");
final uploads = Nitric.bucket("uploads").allow([
BucketPermission.write,
]);
publicApi.get("/upload", (ctx) async {
final photo = uploads.file("images/photo.png");
final url = await photo.getUploadUrl(600);
ctx.res.json({"url": url});
return ctx;
});
}
The SDK is in early stage development and APIs and interfaces are still subject to breaking changes. We’d love your feedback as we build additional functionality!
- Reference Documentation: https://nitric.io/docs/reference/dart
- Guides: https://nitric.io/docs/guides/dart
Learn more by checking out the Nitric documentation.
-
Join us on Discord
-
Ask questions in GitHub discussions
-
Find us on Twitter
-
Send us an email