Flutter Web pre-built Component for faster and simpler integration with Frontegg services.
Frontegg-Flutter is available as an pub.dev package.
dependencies:
frontegg:
[VERSION]
may be latest
, next
or specific versions.
<body>
<!-- set frontegg the first script -->
<script src="https://assets.frontegg.com/admin-box/frontegg/[VERSION].js"></script>
<!-- other scripts -->
</body>
- Use
setUrlStrategy(PathUrlStrategy());
to be able to work with frontegg routes - Edit main.dart file:
void main(){ fronteggApp = initialize(FronteggOptions( version: 'next', contextOptions: ContextOptions( baseUrl: 'https://[HOST_NAME].frontegg.com', requestCredentials: 'include' ) )); /** * wait for frontegg to be loaded and then runApp */ fronteggApp.onLoad(allowInterop(() { runApp(MyApp()); })); }
- In order to observe to changes in Frontegg store:
fronteggApp.onStoreChanged(allowInterop((FronteggState state) { log(state.auth?.user?.email); }));
- Add Frontegg routes as empty Container to the application router
// ... return MaterialApp( title: 'Flutter Demo', initialRoute: '/', routes: { '/': (context) => MyHomePage(title: 'Flutter Demo Home Page'), '/overview': (context) => MyHomePage(title: 'TTTT'), /** * Below Frontegg Routes */ '/account/login': (context) => Container(), '/account/logout': (context) => Container(), '/account/sign-up': (context) => Container(), '/account/activate': (context) => Container(), '/account/invitation/accept': (context) => Container(), '/account/forget-password': (context) => Container(), '/account/reset-password': (context) => Container(), '/account/social/success': (context) => Container() }, // ...
This project is licensed under the terms of the MIT license.