brady_flutter_plugin

Everyone wants an easier way to print. Especially in the field, where dollars are attached to minutes. If your apps can’t connect to a Brady printer, here’s the fix: Brady’s Software Development Kit (SDK). With it, your employees can use their own mobile app to print labels. It’s fast. It’s convenient. It’s a seamless way to get your label data to a Brady printer.

This Brady Print SDK Flutter Package is a display of what the Brady SDK can achieve. You will then have the ability to discover, connect, and print your desired templates and images with the API. The plugin also allows you to see over a dozen printer details and customize how you want your labels to print with printing options.

If your business wishes to print labels from its own mobile application, this is a perfect example to show how seamless the integration can appear when fully completed!

Getting Started

  • Add the following dependency to your pubspec.yaml: brady_flutter_plugin: ^3.0.0+2
  • To demonstrate the basic functionalities of the Brady SDK Flutter Plugin, copy and paste the main.dart under the "example" tab into a fresh Flutter project.
  • For the example app to work, you must provide an image or template (.BWT file) to print. Add the following to the pubspec.yaml: under the "flutter" block:
assets:
   - assets/
  • Now, at the root of your project, create a folder named "assets" and place all images and templates (.BWT files) here.

Android Setup

  • It is recommended to change minSdkVersion in your app/build.gradle to 26.
    • Flutter applications will still build if minSdkVersion is lower than 26. However the SDK will not communicate with printers if the mobile device is less than 26 (Android 8).
  • When developing a Flutter application for Android, the "buildTypes" block in the "app/build.gradle" must be changed to the following:
buildTypes {
    release {
        //The following two lines ensure that no third-party library classes get ignored at compile-time.
        //This is crucial because the Brady Android SDK depends on these classes to make a successful connection.
        shrinkResources false
        minifyEnabled false
        signingConfig signingConfigs.debug
   }
}

iOS Setup

  • The required minimum iOS Version to iOS 15.
  • It is recommended to use the widely used Flutter Permissions library to handle permissions.
    • Add the following to your Flutter app's pubspec.yaml: "permission_handler: ^11.3.1"
  • Add the following permissions to your Podfile's post_install:
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      # You can remove unused permissions here
      # for more information:
      https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handle
      r/ios/Classes/PermissionHandlerEnums.h
      # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        ## dart: PermissionGroup.calendar
        'PERMISSION_EVENTS=0',
        ## dart: PermissionGroup.reminders
        'PERMISSION_REMINDERS=0',
        ## dart: PermissionGroup.contacts
        'PERMISSION_CONTACTS=0',
        ## dart: PermissionGroup.camera
        'PERMISSION_CAMERA=1',
        ## dart: PermissionGroup.microphone
        'PERMISSION_MICROPHONE=0',
        ## dart: PermissionGroup.speech
        'PERMISSION_SPEECH_RECOGNIZER=0',
        ## dart: PermissionGroup.photos
        'PERMISSION_PHOTOS=0',
        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways,
        PermissionGroup.locationWhenInUse]
        'PERMISSION_LOCATION=1',
        'PERMISSION_LOCATION_ALWAYS=1',
        'PERMISSION_LOCATION_WHENINUSE=1',
        ‹
        ## dart: PermissionGroup.notification
        'PERMISSION_NOTIFICATIONS=0',
        ## dart: PermissionGroup.mediaLibrary
        'PERMISSION_MEDIA_LIBRARY=0',
        ## dart: PermissionGroup.sensors
        'PERMISSION_SENSORS=0',
        ## dart: PermissionGroup.bluetooth
        'PERMISSION_BLUETOOTH=1',
        ## dart: PermissionGroup.appTrackingTransparency
        'PERMISSION_APP_TRACKING_TRANSPARENCY=0',
        ## dart: PermissionGroup.criticalAlerts
        'PERMISSION_CRITICAL_ALERTS=0',
      ]
    end
  end
end
  • Add the following permissions to your info.plist:
<key>NSBluetoothAlwaysUsageDescription</key>
<string>To find nearby printers.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>To find nearby printers.</string>
<key>NSLocalNetworkUsageDescription</key>
<string>To find nearby printers.</string>
<key>NSLocationUsageDescription</key>
<string>To find and connect to nearby printers</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>To find and connect to nearby printers</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>To find and connect to nearby printers</string>
<key>NSBonjourServices</key>
    <array>
		<string>_pdl-datastream._tcp.</string>
	</array>
  • Show a permissions request to your user with the following code:
Map<Permission, PermissionStatus> statuses = await [
    Permission.bluetooth,
    Permission.bluetoothConnect,
    Permission.bluetoothScan,
    Permission.nearbyWifiDevices,
    Permission.locationWhenInUse
].request();