This example application demonstrates how one may use Stytch within a Flutter application.
This project uses Stytch's API to securely interact with Stytch.
This application features SMS OTP. You can use this application's source code as a learning resource, or use it as a jumping off point for your own project. We are excited to see what you build with Stytch!
Follow the steps below to get this application fully functional and running using your own Stytch credentials.
-
Create a Stytch account. Once your account is set up a Project called "My first project" will be automatically created for you.
-
Within your new Project, navigate to API Keys, and note your
project_id
andsecret
. You will need these values later on.
In your terminal clone the repo and open the project in VS Code:
git clone https://github.com/stytchauth/stytch-flutter-example.git
cd stytch-flutter-example
Add your project_id
and secret
to your .vscode/launch.json
file:
{
...
"configurations": [
{
"name": "stytch_flutter_example",
...
"args": [
"--dart-define=STYTCH_PROJECT_ID=project_id",
"--dart-define=STYTCH_SECRET=secret"
]
},
...
]
}
After completing all the set up steps above the application can be run as normally from VS Code. To learn how to run a Flutter app in VS Code, please refer to the official Flutter docs.
You'll be able to login with SMS OTP and see your values from your Stytch User object as well as see how logging out works.
This example app showcases a small portion of what you can accomplish with Stytch. Here are a few ideas to explore:
- Add additional login methods like Passwords.
- Use Stytch Sessions to secure your backend.
Join the discussion, ask questions, and suggest new features in our Slack community!
Check out the Stytch Forum or email us at support@stytch.com.