Misar Docs
MisarMailMisar.BlogMisarReachMisarPostMisar.DevMisar PlatformMisar IdentityMisar Posts API
Sdks

Dart SDK

Official Misar.Dev SDK for Dart — build, deploy, and manage apps via api.misar.io/dev.

The official Misar.Dev client SDK for Dart. Async, with built-in retries and typed errors. Works in Dart and Flutter apps.

Installation

Add to pubspec.yaml:

dependencies:
  misar_dev: ^1.0.0

Then run dart pub get (or flutter pub get).

Quick start

Construct a MisarDevClient with your API key (format mdk_…) and point it at the Misar.Dev API:

import 'package:misar_dev/misar_dev.dart';

final client = MisarDevClient(
  apiKey: 'mdk_your_api_key',
  baseUrl: 'https://api.misar.io/dev',
);

// List your projects
final projects = await client.projectsList();
print(projects);

Configuration

ParameterDefaultDescription
apiKeyRequired named parameter. Your API key (mdk_…).
baseUrlhttps://misar.dev/apiSet to https://api.misar.io/dev. Trailing slashes are trimmed.
maxRetries3Retry attempts for retryable status codes (429, 500, 502, 503, 504) with exponential backoff.
httpClientnullOptional package:http Client for injection/reuse.

Every request sends Authorization: Bearer <apiKey> and Content-Type: application/json.

Resources

This early v1.0.0 port implements the following methods. Each returns Future<Map<String, dynamic>>.

MethodHTTPDescription
projectsList()GET /projectsList projects.
projectsCreate(Map<String, dynamic> params)POST /projectsCreate a project.
templatesList()GET /templatesList templates.
apiKeysList()GET /api-keysList API keys.
chatComplete(Map<String, dynamic> params)POST /chatSend a chat completion request.
usageGet()GET /usageRetrieve usage data.
// Create a project
final project = await client.projectsCreate({
  'name': 'my-app',
  'template': 'nextjs',
});

// Chat completion
final reply = await client.chatComplete({
  'messages': [
    {'role': 'user', 'content': 'Hello'}
  ],
});

This is an early v1.0.0 port and intentionally exposes a subset of the full API surface (projects, templates, api-keys, chat, usage). Other resources available in the TypeScript SDK are not yet ported.

Error handling

Non-success responses throw MisarDevApiError; transport-level failures throw MisarDevNetworkError (a subclass with status == 0).

try {
  final projects = await client.projectsList();
} on MisarDevNetworkError catch (e) {
  print('Network error: ${e.message}');
} on MisarDevApiError catch (e) {
  print('API error ${e.status} (${e.errorType}): ${e.message}');
}

Retryable status codes (429, 500, 502, 503, 504) are retried automatically up to maxRetries before the error is thrown.