Java Code Examples for io.flutter.plugin.common.PluginRegistry.Registrar#activeContext()

The following examples show how to use io.flutter.plugin.common.PluginRegistry.Registrar#activeContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeDeviceOrientationPlugin.java    From flutter_native_device_orientation with MIT License 5 votes vote down vote up
/**
 * Plugin registration.
 */
public static void registerWith(Registrar registrar) {
    final MethodChannel methodChannel = new MethodChannel(registrar.messenger(), METHOD_CHANEL);
    final EventChannel eventChannel = new EventChannel(registrar.messenger(), EVENT_CHANNEL);
    final NativeDeviceOrientationPlugin instance = new NativeDeviceOrientationPlugin(registrar.activeContext());

    methodChannel.setMethodCallHandler(instance);
    eventChannel.setStreamHandler(instance);
}
 
Example 2
Source File: NotificationsPlugin.java    From flutter-plugins with MIT License 5 votes vote down vote up
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
    final EventChannel channel = new EventChannel(registrar.messenger(), EVENT_CHANNEL_NAME);
    Context context = registrar.activeContext();
    NotificationsPlugin plugin = new NotificationsPlugin(context);
    channel.setStreamHandler(plugin);
}
 
Example 3
Source File: ScreenStatePlugin.java    From flutter-plugins with MIT License 4 votes vote down vote up
private ScreenStatePlugin(Registrar registrar) {
  context = registrar.activeContext();
}
 
Example 4
Source File: PspdfkitPlugin.java    From pspdfkit-flutter with Apache License 2.0 4 votes vote down vote up
private PspdfkitPlugin(Registrar registrar) {
    this.context = registrar.activeContext();
    this.registrar = registrar;
    this.permissionRequestResult = new AtomicReference<>();
}