mason_api
0.1.2, released 2 months ago by brickhub.dev
Dart API client for Mason CLI
What it does
Provides methods to login, logout, query current user, search, and publish templates to a Mason server. It handles authentication and HTTP communication.
AI-written summary of version 0.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need programmatic access to a Mason server from Dart code
- You want to integrate Mason template publishing into a build or CI pipeline
- You need custom hosted URI support
Skip it when
- You only need the Mason CLI and no custom Dart integration
- You are building a UI that does not interact with Mason server
Strengths
- Simple API, no code generation required
- Supports custom hosted URI
- Built on stable http package
- Lightweight
Weaknesses
- Limited to Mason server features
- No advanced networking features like retries or interceptors
- No built-in error handling beyond basic exceptions
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 6
import 'package:mason_api/mason_api.dart';
const email = 'my@email.com';
const password = 'top-secret!';
Future<void> main() async {
final masonApi = MasonApi();
final user = await masonApi.login(email: email, password: password);
print('Logged in as ${user.email}!');
masonApi.logout();
print('Logged out!');
masonApi.close();
}Alternatives
Packages that do the same job and could replace mason_api.
- chopper
An HTTP client generator for Dart and Flutter using source_gen.
92Compare - retrofit
Dart Dio client generator using source_gen
89Compare - shelf_easy
Lightweight framework with a JSON model generator, database operator, and web/WebSocket server/client.
69Compare - vmodal_sdk_flutter
Typed VModal API client for Flutter to upload videos and search moments by meaning.
67Compare
Works with
Packages commonly used together with mason_api: ones it builds on, ones built on it, and its own family.
- platformmason_api depends on itCross‑platform abstraction for querying runtime platform info in Dart.
- json_annotationmason_api depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- cli_utilmason_api depends on itUtilities to help build Dart command-line apps, find the SDK, and display progress.
- mason_loggerSame familyA lightweight CLI logger with prompts, progress, and custom styling.
- masonSame familyDart template generator for quick file creation
- mason_cliBuilt on mason_apiCLI tool to create and consume reusable template bricks for code generation.