mburger 0.0.1+14 copy "mburger: ^0.0.1+14" to clipboard
mburger: ^0.0.1+14 copied to clipboard

outdated

MBurger Dart client. You can use this package to interact with the MBurger platform (https://www.mburger.cloud).

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mburger/mburger.dart';

void main() {
  MBManager.shared.apiToken = 'YOUR_API_TOKEN';
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'MBurger Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MBurgerExample(),
    );
  }
}

class MBurgerExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('MBurger Example'),
      ),
      body: Column(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          MaterialButton(
            child: Text('Get project'),
            onPressed: () => _getProject(),
          ),
          MaterialButton(
            child: Text('Get block'),
            onPressed: () => _getBlock(),
          ),
          MaterialButton(
            child: Text('Get section'),
            onPressed: () => _getSection(),
          )
        ],
      ),
    );
  }

  /// Retrieves the project connected to the token
  _getProject() async {
    MBProject project = await MBManager.shared.getProject().catchError(
          (error) => print(error),
        );
    print(project);
  }

  /// Retrieves all the sections of a block with the id passed
  _getBlock() async {
    MBBlock block = await MBManager.shared
        .getBlock(
          blockId: 1,
          includeElements: true,
        )
        .catchError((error) => print(error));
    print(block);
  }

  /// Retrieves a sections with the id passed
  _getSection() async {
    MBSection section = await MBManager.shared
        .getSection(
          sectionId: 1,
          includeElements: true,
        )
        .catchError((error) => print(error));
    print(section);
  }
}
10
likes
0
pub points
66%
popularity

Publisher

verified publishermburger.cloud

MBurger Dart client. You can use this package to interact with the MBurger platform (https://www.mburger.cloud).

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

device_info, flutter, flutter_secure_storage, http, http_parser, intl, shared_preferences

More

Packages that depend on mburger