Petnow LogoPetnow

Getting Started

Download the Petnow Flutter package (petnow_camera_ui) from AWS CodeArtifact and add it to a Flutter app.

Overview

petnow_camera_ui is the Petify capture surface for Flutter: the nose-print (dog) and face (cat) camera as a Flutter plugin for Android and iOS. It is not on pub.dev. You download one zip from Petnow's AWS CodeArtifact, which holds the plugin, the Android and iOS SDK binaries, and an example app.

petnow-flutter-1.6.0/
  README.md  LICENSE  NOTICE
  pubspec.yaml  lib/  android/  ios/   the petnow_camera_ui plugin
  example/                             example app
  petnow-maven/                        Android SDK io.petnow:ui:1.6.0 (Maven repository)
  ios/Frameworks/PetnowUI.xcframework  iOS SDK

Prerequisites

Flutter3.41 or newer
AndroidJDK 17 · minSdk 28 · compileSdk 35 or newer · arm64-v8a or x86_64 device
iOSXcode 16 or newer · CocoaPods · iOS 16.4 or newer

The camera needs a physical device. The Android SDK ships arm64-v8a and x86_64 only, so build with --target-platform android-arm64,android-x64 or an App Bundle.

1. Download the package

Create an AWS CodeArtifact key in the Petify Console (Integration → API & SDK). Set the values under these names (see Environment variable names) and download the zip with AWS CLI v2:

unset AWS_PROFILE AWS_SESSION_TOKEN   # so a profile in your shell does not win
export AWS_ACCESS_KEY_ID=<from Petify Console>
export AWS_SECRET_ACCESS_KEY=<from Petify Console>
export AWS_DEFAULT_REGION=<from Petify Console>
export PETNOW_CODEARTIFACT_DOMAIN=<from Petify Console>
export PETNOW_AWS_ACCOUNT_ID=<from Petify Console>
export PETNOW_FLUTTER_REPOSITORY=petnow-flutter

aws codeartifact get-package-version-asset \
  --domain "$PETNOW_CODEARTIFACT_DOMAIN" --domain-owner "$PETNOW_AWS_ACCOUNT_ID" \
  --repository "$PETNOW_FLUTTER_REPOSITORY" --format generic \
  --namespace petnow --package petnow-flutter --package-version 1.6.0 \
  --asset petnow-flutter-1.6.0.zip petnow-flutter-1.6.0.zip

Unzip it into your project, for example under vendor/, and keep the folder as it is: the plugin finds petnow-maven/ and ios/Frameworks/ relative to itself.

mkdir -p vendor && unzip petnow-flutter-1.6.0.zip -d vendor
# -> vendor/petnow-flutter-1.6.0/

2. Add it to your app

pubspec.yaml

dependencies:
  petnow_camera_ui:
    path: vendor/petnow-flutter-1.6.0

Android: set minSdk = 28 in android/app/build.gradle.kts (flutter create defaults to 24). The plugin adds its bundled petnow-maven/ to your build (for the io.petnow group only) and declares the CAMERA and INTERNET permissions. If your app declares repositories in settings.gradle(.kts) with RepositoriesMode.PREFER_SETTINGS, add the package's repository there:

dependencyResolutionManagement {
    repositories {
        maven {
            url = uri("../vendor/petnow-flutter-1.6.0/petnow-maven") // relative to android/
            content { includeGroup("io.petnow") }
        }
    }
}

iOS

  • ios/Podfile: platform :ios, '16.4', then cd ios && pod install.
  • Runner target: Minimum Deployments 16.4.
  • ios/Runner/Info.plist: NSCameraUsageDescription.

The SDK does not request the camera permission. Your app asks for it before it shows the camera.

3. The API key

Use a Client key (app) from the Console. It is the key the SDK takes and is safe to ship in an app. A Secret key (server) stays on your server, which creates capture sessions and registers, verifies or identifies pets. See Key types.

The SDK runs one API key per process: once a camera has started with a key, a different one fails with multipleApiKeys until the app restarts.

Troubleshooting

  • Could not find io.petnow:ui:1.6.0: Gradle did not see petnow-maven/. Keep the unzipped folder intact; with PREFER_SETTINGS, add the block from step 2.
  • CocoaPods "required a higher minimum deployment target": set platform :ios, '16.4' in ios/Podfile and run pod install.
  • MissingPluginException: run flutter clean && flutter pub get and rebuild. A hot restart does not load a new plugin.

Next steps

  • Basic Usage: the camera, prewarm, errors and performance stats
  • Example Apps: the same app for iOS, Android, React Native and Flutter

On this page