Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Documentation
  • Loading branch information
bparrishMines committed Nov 13, 2019
commit 526b88bccd1c5a777083aaff8c244115c5c0e982
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
import java.util.List;
import java.util.Map;

/** FirebaseDynamicLinksPlugin */
/**
* Flutter plugin accessing for Firebase Dynamic Links API.
*
* <p>Instantiate this in an add to app scenario to gracefully handle activity and context changes.
*/
public class FirebaseDynamicLinksPlugin
implements FlutterPlugin, ActivityAware, MethodCallHandler, NewIntentListener {
private Registrar registrar;
Expand All @@ -42,8 +46,23 @@ private FirebaseDynamicLinksPlugin(Registrar registrar, MethodChannel channel) {
this.channel = channel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to pass this in right? The less potentially dangling nulls there are (depending on the path you take), the less likely there will be accidental null pointer exceptions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should need it. The FirebaseDynamicLinks plugins makes callbacks to dart: https://github.com/FirebaseExtended/flutterfire/pull/1372/files#diff-3f6c424218a2662c8ddc4b322f30bf66R81.

I could hold on to a BinaryMessenger and instantiate a MethodChannel every time we want to call invokeMethod, but I think this looks cleaner.

}

/**
* Default Constructor.
*
* <p>Use this when adding the plugin to your FlutterEngine</p>
*/
public FirebaseDynamicLinksPlugin() {}

/**
* Registers a plugin with the v1 embedding api {@code io.flutter.plugin.common}.
*
* <p>Calling this will register the plugin with the passed registrar. However, plugins
* initialized this way won't react to changes in activity or context.
*
* @param registrar attaches this plugin's {@link
* io.flutter.plugin.common.MethodChannel.MethodCallHandler} to the registrar's {@link
* io.flutter.plugin.common.BinaryMessenger}.
*/
public static void registerWith(Registrar registrar) {
final MethodChannel channel = createChannel(registrar.messenger());
final FirebaseDynamicLinksPlugin plugin = new FirebaseDynamicLinksPlugin(registrar, channel);
Expand Down