Knock Flutter client library

A client-side Flutter library to interact with user-facing Knock features, such as feeds.

Note: this is a lower level library designed for building UI on top of

Documentation

See the documentation for usage examples.

iOS

To receive push notifications via APNS (Apple Push Notification Service) you will need to enable the push notification capability in your application. You can find instructions on how to do this at https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns.

Example App

To test APNS integration in the example app, you will need to open example/ios in Xcode and select your Development Team and choose Bundle Identifier unique to you.

Android

To receive push notifications via FCM (Firebase Cloud Messaging) you will need to add Firebase and related dependencies to your application. You can find instructions on how to do this at: https://firebase.google.com/docs/android/setup.

Note: If you've added Firebase to your Flutter app (https://firebase.google.com/docs/flutter/setup?platform=android), you should only need to add a dependency on firebase_messaging (https://firebase.google.com/docs/cloud-messaging/flutter/client).

  1. In your project's android/build.gradle add:
buildscript {
    dependencies {
        ...
        classpath "com.google.gms:google-services:4.3.15"
        ...
    }
}
  1. In your project's android/app/build.gradle add:
plugins {
    ...
    id "com.google.gms.google-services"
    ...
}

dependencies {
    ...
    implementation(platform("com.google.firebase:firebase-bom:YOUR_VERSION"))
    implementation("com.google.firebase:firebase-messaging")
    ...
}
  1. Add google-services.json provided by your Firebase project to app/google-services.json.

Example App

To test FCM integration in the example app, you will need to create a Firebase project and add an appropriate google-services.json file to example/app/google-services.json.

Package Development

Code generation

Code generation is limited to supporting JSON serialization/deserization of API messages. If you need to adust the generated code you will want to run this command from the top level directory.

flutter pub run build_runner build

If you need to update the generated platform channel messages you will want to run this command from the top level directory.

flutter pub run pigeon --input pigeons/messages.dart

Note: Generated files are checked into version control because they are part of the released packaged.

Release (Internal)

Manually update changelog.md file. Update release version in pubspec.yaml Create PR After your PR is merged, run /release status knock-flutter in slack to start the release process

Running Example App

https://docs.flutter.dev/get-started/test-drive

Open the Command Palette.

Go to View > Command Palette or press Command + Shift + P.

Type flutter.

Select the Flutter: Select Device.

If no devices are running, this command prompts you to enable a device.

Select a target device from Select Device prompt.

After you select a target, start the app. Go to Run > Start Debugging or press F5.

Wait for the app to launch.

You can watch the launch progress in the Debug Console view.

After the app build completes, your device displays your app.

Libraries

knock_flutter
Knock Flutter SDK