Skip to content
pubscout

aws_lambda_dart_runtime

1.1.0, released 6 years ago by an unverified publisher

Runtime to build AWS Lambda functions in Dart with native AWS events.

$ flutter pub add aws_lambda_dart_runtime
Source repository

What it does

Allows building AWS Lambda functions using Dart by compiling to native machine code via AOT. It provides a lightweight custom runtime and handles multiple typed AWS event handlers like API Gateway, S3, SQS, and DynamoDB.

AI-written summary of version 1.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to write AWS Lambda functions in Dart
  • You need low memory consumption and fast event processing (< 10ms)

Skip it when

  • You need JIT compilation support
  • You require cross-platform compilation directly from a non-Linux machine without Docker

Strengths

  • Great performance (< 10ms event processing, < 50MB memory)
  • No need to ship the full Dart runtime
  • Supports multiple event handlers and typed native AWS events

Weaknesses

  • Requires building on Linux or via Docker because dart2native does not support cross-compilation
  • No Just-in-time (JIT) support

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
3

Requires building on a Linux machine or using Docker to compile the Dart program to a native executable named bootstrap, then zipping and uploading to AWS Lambda.

import 'package:aws_lambda_dart_runtime/aws_lambda_dart_runtime.dart';

void main() async {
  final Handler<AwsApiGatewayEvent> helloApiGateway = (context, event) async {
    final response = {"message": "hello ${context.requestId}"};
    return InvocationResult(
        context.requestId, AwsApiGatewayResponse.fromJson(response));
  };

  Runtime()
    ..registerHandler<AwsApiGatewayEvent>("hello.apigateway", helloApiGateway)
    ..invoke();
}

Alternatives

Packages that do the same job and could replace aws_lambda_dart_runtime.

Works with

Packages commonly used together with aws_lambda_dart_runtime: ones it builds on, ones built on it, and its own family.