app_wrapper 0.2.2 copy "app_wrapper: ^0.2.2" to clipboard
app_wrapper: ^0.2.2 copied to clipboard

A wrapper that is responsible for initializing various services and utilities needed to run apps safely.

example/main.dart

import 'package:app_wrapper/app_wrapper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_graphql_client/graph_client.dart';

void main() {
  runApp(const YourAppName(
    appContexts: <AppContext>[],
  ));
}

/// [YourAppName] marks as the entry point to your application.
///
/// Wraps your app with [AppWrapper] class.
///
/// Takes in a list of appContexts (e.g `testAppContexts`, `demoAppContexts` or `prodAppContexts`)
/// [context] is the environment which the app is running on.
/// This can be different app `flavours` or environments (`prod`, `test`, `demo`)
class YourAppName extends StatelessWidget {
  const YourAppName({Key? key, required this.appContexts}) : super(key: key);

  final List<AppContext> appContexts;

  @override
  Widget build(BuildContext context) {
    return AppWrapper(
      appName: 'appName',
      graphQLClient: GraphQlClient(
          'id_token', EndpointContext.getGraphQLEndpoint(appContexts)),
      appContexts: appContexts,
      child: Builder(
        builder: (BuildContext context) {
          return const MaterialApp(

              /// Entry point to your application
              );
        },
      ),
    );
  }
}
3
likes
120
pub points
3%
popularity

Publisher

verified publishersavannahghi.org

A wrapper that is responsible for initializing various services and utilities needed to run apps safely.

Repository (GitHub)
View/report issues
Contributing

Documentation

Documentation
API reference

License

MIT (LICENSE)

Dependencies

camera, flutter, flutter_graphql_client, local_auth, platform

More

Packages that depend on app_wrapper