m3o 1.0.226 icon indicating copy to clipboard operation
m3o: ^1.0.226 copied to clipboard

This is the Dart client to access APIs like DB, Functions, App, Events and more on the M3O Platform

Discord Banner

M3O Dart Client #

This is the Dart client to access APIs on the M3O Platform

What is M3O #

M3O is an attempt to build a new public cloud platform with higher level building blocks for the Next generation of developers. M3O is powered by the open source Micro platform and programmable real world Micro Services.

M3O APIs includes DB, Cache, Stream, MQ, Events, Functions, App, SMS and more.

Usage #

Call a service using the generated client. Populate the M3O_API_TOKEN environment variable.

Import the package and initialise the service with your API token.

import 'dart:io';

import 'package:m3o/src/helloworld/helloworld.dart';

void main() async {
  final hwservice = HelloworldService(Platform.environment['M3O_API_TOKEN']!);

  CallRequest req1 = CallRequest(name: 'Mighty Zeus');
  StreamRequest req2 = StreamRequest(messages: 15, name: 'World');

  try {
    CallResponse res1 = await hwservice.call(req1);
    res1.map((value) => print(value.message),
        Merr: (CallResponseMerr err) => print(err.body!['body']));

    final st = await hwservice.stream(req2);
    await for (var sr in st) {
      sr.map((value) => print(value.message),
          Merr: (StreamResponseMerr err) => print(err.body));
  } catch (e) {
  } finally {

Generic Client #

The generic client enables you to call any endpoint by name.

import 'dart:io';

import 'package:m3o/src/client/client.dart';

void main() async {

    final client = Client(Platform.environment['M3O_API_TOKEN']!);

    Request request = Request(
        service: 'helloworld',
        endpoint: 'Call',
        body: {
        'name': 'John',

    Response res = await client.call(request);



Widget #

Most M3O services have endpoints that return a Future and few that return Stream. In order to use M3O clients with Flutter, you need to wrap it with FutureBuilder and StreamBuilder.

For example, you can write a function that return Future<NowResponse> from the weather service like this:

Future<NowResponse> londonCurrentWeather() async {
  final wservice = WeatherService(Platform.environment['M3O_API_TOKEN']!);

  NowRequest req = NowRequest(location: 'lonon');
  try {
    NowResponse res = await wservice.now(req);
    return res;
  } catch (e) {
    // handle error

and then use FutureBuilder to create a widget like this:

class MyWidget extends StatefulWidget {
  // code here ...

  _MyWidgetState creatState() => _MyWidgetState();

class _MyWidgetState extends State <MyWidget> {
  late final nowResponse = londonCurrentWeather();

  Widget build(BuildContext context) {
    return FutureBuilder(
      future: nowResponse,
      builder: (context, snapshot) {
        if (snapshot.hasError) {
          // return a widget in case of an error

        if (snapshot.hasData) {
          // extract the data and return a widget

        return CircularProgressIndicator();
pub points


verified publisher iconm3o.com

This is the Dart client to access APIs like DB, Functions, App, Events and more on the M3O Platform

Repository (GitHub)
View/report issues


API reference


Icon for licenses.unknown (LICENSE)


freezed_annotation, json_annotation


Packages that depend on m3o