init static method

Future<String> init(
  1. String configFileName
)

Init B2C application. It look for existing accounts and retrieves information.

The configFileName argument specifies the name of the json configuration file. Placement of the configuration file depends from the platform:

  • Android: android/app/main/res/raw
  • Web: web/assets

This method should be called as soon as the application launches. A good place to call this method is the State.initState function of the main widget of the app (just after the handleRedirectFuture has completed).

{@tool snippet}

  class _MyAppState extends State<MyApp> {

    @override
    void initState() {
      super.initState();
      AzureB2C.handleRedirectFuture()
          .then((_) => AzureB2C.init("auth_config"));
    }

{@end tool}

The result of the method call is returned asynchronously to any AzureB2CCallback registered to the B2COperationSource.INIT topic. Possible operation states are:

See also:

Implementation

static Future<String> init(String configFileName) async {
  _channel.setMethodCallHandler(_methodCallHandler);
  var tag = GUIDGen.generate();
  var args = {"tag": tag, "configFile": configFileName};

  await _channel.invokeMethod('init', args);
  return tag;
}