Getting started with Nutrient Flutter SDK

Table of contents

    Getting started with Nutrient Flutter SDK
    Summary

    This tutorial provides a comprehensive guide to getting started with Nutrient’s Flutter PDF SDK, walking through the setup process — from installation, to running a sample project. The guide covers installing necessary tools like Flutter SDK and platform-specific IDEs, cloning the repository, configuring platform-specific settings, and running the example application on both Android and iOS devices, demonstrating the SDK’s cross-platform capabilities.

    At Nutrient, we support all major hybrid technologies, including Flutter(opens in a new tab), and Nutrient Flutter SDK is the newest addition to our growing hybrid technology family.

    In this post, you’ll learn how to get started with our Flutter PDF library. We’ll start by providing a quick definition of Flutter, and then we’ll show you how to install, clone, and set up Nutrient Flutter SDK.

    What is Flutter?

    Flutter(opens in a new tab) is a relatively new hybrid technology (compared to Cordova, Xamarin, and React Native, which are all at least a few years old) and it’s made by Google. According to Google, “Flutter allows you to build beautiful native apps on iOS and Android from a single codebase.”

    Flutter uses Google’s own programming language, Dart, which is somewhat similar to JavaScript and has built-in support for type safety. Flutter has some great features — like hot reload, which allows you to quickly reload an app and view changes without having to restart the app — and it comes with a modern reactive framework and lots of widgets.

    When we first looked into using Flutter, we enjoyed the development experience, and our experimenting resulted in the Nutrient Flutter library. In this post, I’ll talk about how to get started with Nutrient Flutter SDK. I’ll also discuss how easy and fast it is to get our sample project running on both Android and iOS.

    There are four steps, which you’ll find below.

    Step 1 — Installing the Flutter SDK and the IDEs

    Before we get started, we need to make sure the Flutter SDK(opens in a new tab), Android Studio(opens in a new tab), and Xcode(opens in a new tab) are all installed.

    If you’re following this tutorial on a single platform, it’s not necessary to install the other platform’s IDE. For example, if you want to run the sample project on Android, it’s unnecessary to install Xcode.

    Step 2 — Cloning the Nutrient Flutter repository

    You need to download or clone the repository(opens in a new tab) for Nutrient Flutter SDK:

    Terminal window
    git clone [email protected]:PSPDFKit/pspdfkit-flutter.git

    Step 3 — Setting up Nutrient

    For Android, you need to create a local property file in pspdfkit-flutter/example/android/local.properties and specify the following properties:

    sdk.dir=/path/to/your/Android/sdk
    flutter.sdk=/path/to/your/flutter/sdk
    flutter.buildMode=debug

    Now, cd into the pspdfkit-flutter/example directory, and run flutter emulators --launch <EMULATOR_ID> to launch the desired emulator, like so:

    Terminal window
    cd pspdfkit-flutter/example
    flutter emulators --launch <EMULATOR_ID>

    Optionally, you can repeat this step to launch multiple emulators.

    Step 4 — Building and running

    The app is ready to start! Run flutter run -d all to deploy the Nutrient Flutter example on all your connected devices:

    Terminal window
    flutter run -d all
    AndroidiOS
    opened-pdf-document-androidopened-pdf-document-ios

    Conclusion

    Our Flutter PDF SDK offers a variety of additional features and capabilities, including:

    At Nutrient, we offer a commercial, feature-rich, and completely customizable Flutter PDF library that’s easy to integrate and comes with well-documented APIs. To get started, try it for free.

    Rad Azzouz

    Rad Azzouz

    Explore related topics

    FREE TRIAL Ready to get started?