Setup ApparenceKit with Http Client
Prerequisites
You must have installed
1 - Generate your app
Now ApparenceKit CLI installed,
you can run the setup command to setup the template with your needs.
Open a terminal and run the following command in the root of your project:
dart pub global run apparence_cli setup .
You will be asked to choose between using Firebase or Supabase or Http Client.
Choose Http client then press enter.
You will also be asked about
- Using Sentry for error reporting
- Using Firebase Remote Config for A/B testing
- Using Mixpanel for analytics
- Adding Internationalization
- Adding introduction screens ...
2 - Setup firebase for notifications or remote config
ApparenceKit uses Firebase Cloud Messaging to send notifications to your users.
So you need to install the firebase_tools
We need firebase for the push notifications or remote config.
- Google force us to create a project for Android application
- Firebase allows us to send push notifications to iOS and Android devices
You must first create a firebase project here
Install firebase cli
On Mac, you can install it with
brew install firebase-cli
Or with npm
npm install -g firebase-tools
Check the official documentation for other OS.
Login to firebase
firebase login
Flutterfire cli
Flutter fire cli is a tool to generate firebase configuration files with flutter.
Install it with
dart pub global activate flutterfire_cli
Configure your project (dev environment here)
# flutterfire configure --project=YOUR_PROJECT_NAME --out lib/firebase_options_[environment].dart
# Ex:
flutterfire configure --project=apparencekit-pro --out lib/firebase_options_dev.dart
This will output a configuration file into your lib folder.
Create as many environments as you need.
Remove firebase generated files
I recommend you to remove any firebase generated files from Android / iOS folders.
Flutter recently added a new way to configure firebase, relying on dart code.
- remove the google-services.json file from the android/app folder
- remove the GoogleService-Info.plist file from the ios/Runner folder
Setup firebase
import 'package:apparence_kit/firebase_options_dev.dart' as firebase_dev;
...
void main() async {
...
await env.when(
dev: (_) => Firebase.initializeApp(
options: firebase_dev.DefaultFirebaseOptions.currentPlatform,
),
...
);
}