MBManager class

The manager of the MBurger SDK, you will use this class to make requests to MBurger.

Constructors

MBManager({required String? apiToken, String? locale, MBurgerChannel channel = MBurgerChannel.stable})
Initializes a MBManager with an apiToken.

Properties

apiToken String?
The API token used to make all the requests to the apis.
getter/setter pair
channel MBurgerChannel
The MBurger channel that will be queried (stable/develop/master).
getter/setter pair
endpoint String
The endpoint of MBurger, it uses the development flag to switch between dev and prod environments.
no setter
hashCode int
The hash code for this object.
no setterinherited
locale String?
The locale used to make the requests.
getter/setter pair
localeForApi String
The locale sent by the manger to the apis.
no setter
plugins List<MBPlugin>
Additional plugins for MBurger
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

defaultParameters() Future<Map<String, String>>
Default parameters sent to MBurger.
getAllMedia() Future<List<MBMedia>>
Retrieve all the media of the project.
getBlock({required int blockId, List<MBParameter> parameters = const [], bool includeSections = false, bool includeElements = false}) Future<MBBlock>
Retrieve the block of the project with the specified id.
getBlocks({List<MBParameter> parameters = const [], bool includeSections = false, bool includeElements = false}) Future<MBPaginatedResponse<MBBlock>>
Retrieve the blocks of the project.
getMedia(int mediaId) Future<MBMedia>
Retrieve the media of the project with the specified id.
getProject({bool includeContracts = false}) Future<MBProject>
Retrieve the MBurger project.
getSection({required int sectionId, List<MBParameter> parameters = const [], bool includeElements = false}) Future<MBSection>
Retrieve the sections with the specified id.
getSections({required int blockId, List<MBParameter> parameters = const [], bool includeElements = false}) Future<MBPaginatedResponse<MBSection>>
Retrieve the sections of the block with the specified id.
getSectionWithSlug({required String slug, List<MBParameter> parameters = const [], bool includeElements = false}) Future<MBSection>
Retrieve the sections with the specified slug.
headers({bool contentTypeJson = false}) Future<Map<String, String>>
Default headers sent to MBurger.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pluginOf<T>() → T?
Returns the plugin of the specified type in the array of plugins
toString() String
A string representation of this object.
inherited
votePoll(int pollId, int answerIndex) Future<MBPollVoteResponse>
Votes for a poll.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

shared MBManager
The singleton that manages all the data sent and received to/from MBurger.
no setter

Static Methods

checkResponse(String response, {bool checkBody = true}) Map<String, dynamic>
Checks the response of the api call and returns the body, it throws a MBException if it encounters an error.
checkResponseForType<T>(String response, {bool checkBody = true}) → T
Function to check the response of the api and parse the response as the type passed