FedID Flutter package
Utilizing the Flutter package for FedID involves the same steps as using any other package. First, add FedID to your Flutter project:
# Post-release, FedID will be available in the Flutter repository
flutter pub add fedid
# Until then you can clone the repo at https://codeberg.org/fedid/flutter-library
# and include it in ypur `pubspec.yaml`:
#
# dependencies:
# ...
# fedid:
# path: ../library-flutter/src
# ...
After spinning up your FedID server, you will next need to tell your app to use the FedID Server:
# Import the package
import 'package:fedid/package.dart';
# Set your resolver URL
setFedIdResolverUrl('https://fedid.domain.ext', context);
And to enable FedID logins, you will need to enable support for custom URLs by adding this to your AndroidManifest.xml
, inside the activity
block:
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fedid" android:host="fedid.me" android:pathPrefix="/fedid-login" />
</intent-filter>
Lastly, there are two routes you can use to direct users to the screens built into the package:
Route | Description |
---|---|
/fedid-accounts | Add/edit/remove accounts from the device |
/fedid-login | Login to services using a FedID Account |
These can be used at any point with the standard Navigator
or any custom navigation:
onPressed: () {
Navigator.restorablePushNamed(
context,
'/fedid-accounts',
);
},