Flutter (Dart):
BradyFlutterPlugin()
BradyFlutterPlugin() is the constructor of the Brady SDK library and is used to initialize the object you will call all methods on.
suppliesMatch() → Future<bool?>
suppliesMatch() returns a Boolean representing if the selected template was not designed with the supply that is installed in the connected printer.
connect(String? printer, bool? connectWithBluetooth) → Future<bool?>
connect(String?, bool?) takes the name of a discovered printer and the protocol to connect over and attempts to connect the mobile device to the printer.
- @param printer is a string representing the name of the printer to connect to.
- @param connectWithBluetooth is a bool representing the protocol to connect over.
- true: search for a printer discovered over bluetooth with the matching name.
- false: search for a printer discovered over Wi-Fi network with the matching name.
- null: ignores protocol and connects to any printer matching the name.
- @returns a bool representing the connection result.
cutSupply() → Future<bool?>
cutSupply() asynchronously makes the connected printer perform a cut operation (this can be called right after feed() for testing purposes) and returns a Boolean value afterwards with the result of the cut operation (i.e. success or failure).
disconnect() → Future<bool?>
disconnect() asynchronously disconnects from the currently connected printer and returns a Boolean value afterwards with the result of the disconnect operation (i.e. success or failure).
disconnectWithoutForget() → Future<bool?>
disconnectWithoutForget() asynchronously disconnects from the currently connected printer and returns a Boolean value afterwards with the result of the disconnect operation (i.e. success or failure).
feedSupply() → Future<bool?>
feedSupply() asynchronously makes the connected printer print one empty label and returns a Boolean value afterwards with the result of the feed operation(i.e. success or failure).
forgetLastConnectedPrinter() → void
forgetLastConnectedPrinter() clears the value of "LastConnectedPrinterName internally preventing auto-connections.
getAvailablePrinterUpdates() → Future<List<String?>>
getAvailablePrinterUpdates() returns a list of string representing all printer updates that occurred since the last time this method was called.
getBatteryLevelPercentage() → Future<int?>
getBatteryLevelPercentage() returns a String representing the battery level percentage of the connected printer.
getConnectionType() → Future<String?>
getConnectionType() returns a String representing the protocol that was used to connect to the printer.
getHaveOwnership() → Future<bool?>
getHaveOwnership() returns a Boolean representing the mobile device's ownership of a nearby M211.
getIsAcConnected() → Future<bool?>
getIsAcConnected() returns a Boolean representing if the connected printer is charging.
getIsSupplyPreSized() → Future<bool?>
getIsSupplyPreSized() returns a Boolean representing if the supply installed in the connected printer is pre-sized. If false, the supply is continuous.
getLastConnectedPrinterName() → Future<String?>
getLastConnectedPrinterName() returns a String representing the name of the last printer that the app connected to.
getPreview(int elementSize) → Future<String?>
getPreview(Int) takes an Integer that represents the width in screen pixels that the print preview should display as (on the UI).
getPrinterModel() → Future<String?>
getPrinterModel() returns a String representing the current connected printer's model.
getPrinterName() → Future<String?>
getPrinterName() returns a String representing the current connected printer's name.
getPrinters() → Future<Map<String, String>>
getPrinters() returns a Map of Strings representing the printer name and how it was discovered via the discovery scan. Items from this list will only be removed on subsequent launches of the app.
getPrinterStatus() → Future<String?>
getPrinterStatus() returns a String representing the current printer connection status.
getPrinterStatusMessage() → Future<String?>
getPrinterStatusMessage() returns a String representing the current printer connection status message.
getPrinterStatusMessageTitle() → Future<String?>
getPrinterStatusMessageTitle() returns a String representing the current printer connection status message title.
getPrinterStatusRemedyExplanationMessage() → Future<String?>
getPrinterStatusRemedyExplanationMessage() returns a String representing a solution to resolve the current printer error if there is one.
getRibbonName() -> Future<String?>
getRibbonName() returns a String representing the ribbon installed in the printer (will return empty string if there is no ribbon). Only the M611 and M710 support ribbons.
getRibbonRemainingPercentage() -> Future<int?>
getRibbonRemainingPercentage() returns an int representing the percentage of ribbon remaining in the connected printer (will return 0 if there is no ribbon). Only the M611 and M710 support ribbons.
getRibbonColor() -> Future<int?>
getRibbonColor() returns an int representing the color of the installed ribbon to the connected printer
getSupplyHeight() → Future<double?>
getSupplyHeight() returns a String representing the height of the supply installed in the connected printer.
getSupplyName() → Future<String?>
getSupplyName() returns a String representing the supply installed in the connected printer.
getSupplyRemainingPercentage() → Future<int?>
getSupplyRemainingPercentage() returns a String representing the percentage of supply remaining in the connected printer
getSupplyWidth() → Future<double?>
getSupplyWidth() returns a String representing the width of the supply installed in the connected printer.
getSupplyColor() -> Future<int?>
getSupplyColor() return an int representing the color of the supply installed in the connected printer.
getTemplateData() → Future<Map<String, String>>
getTemplateDataNames returns all object names on the current template.
getTemplateSupplyName() → Future<String?>
getTemplateSupplyName() returns the name of the supply that used to design the selected template
getYNumber() -> Future<String?>
getYNumber() returns a String representing the unique Y Number of the installed supply.
print(int copies, bool cutAfterEachLabel, bool isCollated, bool printTrailer) → Future<bool?>
print() asynchronously sends a print job of the currently set template to the printer that the app is currently connected to and returns a Boolean value afterwards with the result of the print operation (i.e. success or failure).
Example 1: bool result = BradyFlutterPlugin().print(2, true, true, false) on a template which contains two differently designed labels. This will print two copies of both labels in the template (four labels in total) and will cut each one separately. These will also be collated and printed in the order of 1, 2, 1, 2.
Example 2: bool result = BradyFlutterPlugin().print(3, false, false, false) on a template which contains two differently designed labels. This will print three copies of both labels in the template (six labels in total) and will only cut after all six are printed. Therefore, it will print one long label. Since "isCollated" is false, it will print the labels in the order of 1, 1, 1, 2, 2, 2.
printBitmapWithDimensions(double bitmapWidthInInches, double labelLengthInInches, int copies, bool cutAfterEachLabel, bool isCollated, bool printTrailer) → Future<bool?>
printBitmapWithDimensions() asynchronously sends a print job of the currently set template or bitmap image to the printer that the app is currently connected to and returns a Boolean value afterwards with the result of the print operation (i.e. success or failure).
setAutomaticShutoffTime() -> Future<bool?>
setAutomaticShutoffTime() asynchronously sets the automatic shutdown time of the printer in minutes and returns a Boolean value afterwards with the result of the setAutomaticShutoffTime operation (i.e. success or failure).
setPlaceholderValue(String placeholder, String value) → void
setPlaceholderValue(String, String) takes two Strings to set a placeholder with a specified value.
setTemplate(String filePath) → void
setTemplate(String) takes a file path (i.e. 'assets/MyTemplate.BWT' or 'assets/MyImage.PNG') as a string representing a template file or image. This method sets the current template or image being acted upon when setPlaceholderValue(String, String) or print() is called. Therefore, calling setTemplate(String) again will override any previous template that has been set.
setTemplateWithBase64(String filePath, bool isTemplate) → void
setTemplateWithBase64(String, bool) takes a base64 string of data representing a template or image file and a boolean that tells the plugin if the file is a template.
- If true, the back-end will treat the base64 string like a BWT or BWS file.
- If false, the back-end will treat the base64 string like a PNG, JPG, etc.
This is converted to useful information about the template in the back-end code. This method sets the current template being acted upon when setPlaceholderValue(String, String) or print() is called. Therefore, calling setTemplateWithBase64(String, bool) again will override any previous template that has been set.
startBlePrinterDiscovery() → void
startPrinterDiscovery() starts the Bluetooth scan for nearby Brady Printers. All of the details about these devices are stored internally and can be retrieved using the getPrinters() API method.
startWifiPrinterDiscovery() → void
startWifiPrinterDiscovery() starts the Wifi scan for nearby Brady Printers. All of the details about these devices are stored internally and can be retrieved using the getPrinters() API method.
stopPrinterDiscovery() → void
stopPrinterDiscovery() stops all discovery scans that were previously started.