{"slug": "i-built-fast-api-but-for-flutter-dart-ai", "title": "I Built Fast API, but for Flutter/Dart & AI", "summary": "A developer has released fast_crud_api, an open-source Dart and Flutter package that provides a lightweight, customizable CRUD API server built on the shelf middleware library. The package exposes /create, /read, /update, and /delete endpoints, which the developer says can give AI agents a pathway to control specific app functionality, such as managing notes in a Flutter app. It also supports custom routes for developers who want to skip the built-in CRUD scaffolding.", "body_md": "One of my favorite Python Packages is `fastapi`. I love how you can build an API server very quickly with minimal code. Then, to top it off, you can use its built-in Swagger UI to test your API. \n\nTo my knowledge, Flutter/Dart has no package that does this...\n\nI will build it myself...\n\nYou got me! It was really to connect AI Agents to my Flutter applications- why, of course!\n\nI did not build this package from the ground up; I had some help!\n\nIntroducing `shelf`, a web-server middleware package for Dart.\n\nI used `shelf` to create a Flutter package named `fast_crud_api`. \n\n`fast_crud_api` is a lightweight, simple, and customizable CRUD API Server in Dart.\n\nCRUD is an acronym for Create, Read, Update, and Delete, representing the four fundamental operations for managing persistent data in software applications and databases.\n\nI built CRUD into the package because it creates a pathway for an AI Agent to control specific app functionality. With four endpoints (`/create`, `/read`, `/update`, and `/delete`). \n\nFor example, if I created a notes app in Flutter. With `fast_crud_api`, I could connect an AI Agent to create, read, update, and delete notes. Effectively giving the AI Agent a new skill that it can use.\n\nLikewise, you could leave the CRUD out of it and create a custom API instead!\n\n`APIServer` is the main implementation and has the following parameters:\n\n```\nclass APIServer {\n  final String? apiName;\n  final Future<Response> Function(Request)? create;\n  final Future<Response> Function(Request)? read;\n  final Future<Response> Function(Request)? update;\n  final Future<Response> Function(Request)? delete;\n  final int? port;\n  final int? version;\n  final List<CustomRoute>? routes;\n  final bool? noCRUD;\n  final bool? logger;\n\n  APIServer({\n    this.create,\n    this.read,\n    this.update,\n    this.delete,\n    this.port,\n    this.version,\n    this.apiName,\n    this.routes,\n    this.noCRUD,\n    this.logger,\n  });\n}\n```\n\n`start()` that creates and starts the API server.\nNow let's add `fast_crud_api` to your Flutter or Dart project.\n\n`fast_crud_api` to your Flutter/Dart app:\n`shelf` to your `pubspec.yaml` file:\n\n```\ndependencies:\n  shelf: any\n  fast_crud_api:\n    git:\n      url: https://github.com/DylanScottMickelson/fast_crud_api.git\n```\n\nNow, run `flutter pub get` or `dart pub get` in your terminal/command prompt to install the package and its dependencies.\n\nAdd this example code inside your `main.dart` file:\n\n```\nimport 'package:fast_crud_api/fast_crud_api.dart';\nimport 'package:shelf/shelf.dart';\n\nvoid main() async {\n  /// Define your create, read, update, and delete functions here...\n  Future<Response> createFunction(Request request) async {\n    return Response.ok(\"Created!\");\n  }\n\n  Future<Response> readFunction(Request request) async {\n    return Response.ok(\"Read!\");\n  }\n\n  Future<Response> updateFunction(Request request) async {\n    return Response.ok(\"Updated!\");\n  }\n\n  Future<Response> deleteFunction(Request request) async {\n    return Response.ok(\"Deleted!\");\n  }\n  /// Create API Server Implementation\n  final apiServer = APIServer(\n    create: (request) => createFunction(request),\n    read: (request) => readFunction(request),\n    update: (request) => updateFunction(request),\n    delete: (request) => deleteFunction(request),\n    port: 6969,\n    version: 1,\n    apiName: \"My API\",\n    noCRUD: false,\n    logger: true,\n  );\n  ///Start API Server\n  await apiServer.start();\n}\nimport 'package:fast_crud_api/custom_route.dart';\nimport 'package:fast_crud_api/fast_crud_api.dart';\nimport 'package:shelf/shelf.dart';\n\nvoid main() async {\n  final handler = Response.notFound;\n\n  /// Define your create, read, update, and delete functions here...\n  Future<Response> createFunction(Request request) {\n    return Response.ok(\"Created!\");\n  }\n\n  Future<Response> readFunction(Request request) {\n    return Response.ok(\"Read!\");\n  }\n\n  Future<Response> updateFunction(Request request) {\n    return Response.ok(\"Updated!\");\n  }\n\n  Future<Response> deleteFunction(Request request) {\n    return Response.ok(\"Deleted!\");\n  }\n\n  /// Define your custom endpoints here...\n  final customRoute1 = CustomRoute(\n    endpoint: \"users\",\n    method: \"GET\",\n    handler: (request) => Response.ok(\"Users Read!\"),\n  );\n\n  final apiServer = APIServer(\n    create: (request) => createFunction(request),\n    read: (request) => readFunction(request),\n    update: (request) => updateFunction(request),\n    delete: (request) => deleteFunction(request),\n    port: 6969,\n    version: 1,\n    apiName: \"My API\",\n    noCRUD: false,\n    logger: true,\n    routes: [customRoute1],\n  );\n\n  await apiServer.start();\n}\nimport 'dart:convert';\n\nimport 'package:fast_crud_api/custom_route.dart';\nimport 'package:fast_crud_api/fast_crud_api.dart';\nimport 'package:shelf/shelf.dart';\n\nvoid main() async {\n  /// Define your custom endpoints here...\n  final customRoute1 = CustomRoute(\n    endpoint: \"users\",\n    method: \"GET\",\n    handler: (request) => Response.ok(jsonEncode({\"users\": []})),\n  );\n\n  final apiServer = APIServer(\n    port: 6969,\n    version: 1,\n    apiName: \"My API\",\n    noCRUD: true,\n    logger: true,\n    routes: [customRoute1],\n  );\n\n  await apiServer.start();\n}\n```\n\nProduction:\n\nGo to [http://ip_address:chosen_port/api/docs/](http://ip_address:chosen_port/api/docs/)\n\nTest:\n\nGo to [http://127.0.0.1:6969/api/docs/](http://127.0.0.1:6969/api/docs/)\n\nProduction:\n\nTest:\n\nBuilding an efficient backend layer for a modern application can often feel like solving multiple puzzles at once. But with fast_crud_api, that process is streamlined significantly.\n\nBy leveraging Dart's power and the `shelf` package, `fast_crud_api` provides developers with a lightweight, and customizable API server. \n\nThe key takeaway isn't just how to set up an API server in Flutter/Dart, but what you can do with it. Namely, giving AI Agents standardized, reliable endpoints (Create, Read, Update, Delete) that allow them to interact with your application data seamlessly.\n\nI hope this walkthrough was helpful! Comment and let me know what you think, or dive into the code in the GitHub [repo](https://github.com/DylanScottMickelson/fast_crud_api).\n\nHappy coding! 🧑💻", "url": "https://wpnews.pro/news/i-built-fast-api-but-for-flutter-dart-ai", "canonical_source": "https://dev.to/dylanscottmickelson/i-built-fast-api-but-for-flutterdart-ai-57c", "published_at": "2026-09-23 00:33:13+00:00", "updated_at": "2026-09-23 00:52:41.566195+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-tools"], "entities": ["fast_crud_api", "shelf", "Flutter", "Dart", "FastAPI", "Swagger UI", "DylanScottMickelson"], "alternates": {"html": "https://wpnews.pro/news/i-built-fast-api-but-for-flutter-dart-ai", "markdown": "https://wpnews.pro/news/i-built-fast-api-but-for-flutter-dart-ai.md", "text": "https://wpnews.pro/news/i-built-fast-api-but-for-flutter-dart-ai.txt", "jsonld": "https://wpnews.pro/news/i-built-fast-api-but-for-flutter-dart-ai.jsonld"}}