Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import io.flutter.plugin.platform.PlatformViewFactory

class ArCoreViewFactory(val activity: Activity, val messenger: BinaryMessenger) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {

override fun create(context: Context, id: Int, args: Any?): PlatformView {
override fun create(context: Context?, id: Int, args: Any?): PlatformView {
val params = args as HashMap<*, *>
val debug = params["debug"] as Boolean
val type = params["type"] as String
Expand All @@ -22,11 +22,11 @@ class ArCoreViewFactory(val activity: Activity, val messenger: BinaryMessenger)
}

if (type == "faces") {
return ArCoreFaceView(activity, context, messenger, id, debug)
return ArCoreFaceView(activity, context!!, messenger, id, debug)
} else if (type == "augmented") {
val useSingleImage = params["useSingleImage"] as? Boolean ?: true
return ArCoreAugmentedImagesView(activity, context, messenger, id, useSingleImage, debug)
return ArCoreAugmentedImagesView(activity, context!!, messenger, id, useSingleImage, debug)
}
return ArCoreView(activity, context, messenger, id, type == "faces", debug)
return ArCoreView(activity, context!!, messenger, id, type == "faces", debug)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ArcoreFlutterPlugin : FlutterPlugin, ActivityAware {
fun registerWith(registrar: Registrar) {
registrar
.platformViewRegistry()
.registerViewFactory(CHANNEL_NAME, ArCoreViewFactory(registrar.activity(), registrar.messenger()))
.registerViewFactory(CHANNEL_NAME, ArCoreViewFactory(registrar.activity()!!, registrar.messenger()))
}
}

Expand Down Expand Up @@ -64,4 +64,4 @@ class ArcoreFlutterPlugin : FlutterPlugin, ActivityAware {
}


}
}