Flutter Setup
In this guide, you'll learn how to create a Flutter app and initialize it with the Okto SDK, including setting up authentication using Google OAuth and the Okto Provider.
This quickstart guide will help you set up a basic Flutter app using the Okto SDK. Follow these steps to get your app up and running quickly.
Prerequisites
Ensure you have Flutter installed and set up on your system. Run the following command to verify your setup:
All checks should return green. If not, address any issues before proceeding.
Set up Google Cloud Console
- Go to the Google Cloud Console.
- Follow our Google Authentication Setup Guide to create a new project and obtain the necessary credentials.
Required Client IDs
Depending on your target platforms, you'll need:
- Android devices: Web Client ID and Android Client ID
- iOS devices: iOS Client ID
- Both platforms: Web Client ID, Android Client ID, and iOS Client ID
Configure dependencies
Update your pubspec.yaml
file to include the following dependencies:
Then run:
Create a strings.xml
file under android/app/src/main/res/values/
with the following content:
Replace YOUR_WEB_CLIENT_ID
with your actual Web Client ID from Google Console.
Create necessary files
Create the following files in your project:
.env
file in the root folder:
If not already added, add your .env
to your pubsec.yaml
under the assets section:
lib/utils/okto.dart
:
lib/utils/global.dart
:
Run your app
You can now run your Okto-integrated Flutter app:
Your app should now have basic Okto SDK integration with Google Sign-In functionality.
Congratulations!
🎉 Congratulations! You now have a Flutter app powered by Okto. You can focus on your business logic and UI/UX now. You can checkout how to use other features in our Flutter Template Repo.