Questions tagged [flutter-method-channel]

Flutter uses a flexible system that allows you to call platform-specific APIs whether available in Kotlin or Java code on Android, or in Swift or Objective-C code on iOS. A named channel for communicating with platform plugins using asynchronous method calls.

146 questions
0
votes
0 answers

How to send asyncronous response when calling MethodChannel?

Flutter official documentation says we can't use EventChannel for both-direction communication between Flutter and Native code, only on listening events from Native. So the MethodChannel is the only recommended way to call a method on native from…
empiresdev
  • 153
  • 1
  • 7
0
votes
1 answer

How to call a Flutter function from native implementation of Work manager in android?

Have a look at the images. I'm trying to implement the android work manager natively via the method channel. Now, if we start the work manager, I need to call a method on the Flutter side. I can't find a way to do that. I need flutterEngine for…
0
votes
0 answers

MethodChannel callbacks from native to dart using a custom plugin not working

I have a custom flutter plugin. From Flutter app I call the setMethodCallHandler on the channel which I use to invoke method on native. Flutter to native communication works along with the responses. But the reverse is not working, where the methods…
user2832203
  • 85
  • 2
  • 9
0
votes
0 answers

type 'List' is not a subtype of type 'List>' in type cast - Flutter

I am trying to call a MethodChannel which is supposed to return a List>. I tried using both, invokeMethod as well as invokeListMethod, but I get some sort of type casting error. For example, in case of .invokeMethod as …
dev404
  • 1,047
  • 8
  • 21
0
votes
2 answers

How to solve error: Type mismatch: inferred type is String? but String was expected

I have an error like this: "Type mismatch: inferred type is String? but String was expected" Here is my function: fun updateIcon(name: String) { val context = MainActivity.appContext val packageName: String =…
chuanpham
  • 112
  • 1
  • 9
0
votes
1 answer

Getting No virtual method getSavedStateRegistry() in Android when calling MethodChannel in Flutter?

I am developing an app in flutter . I am trying to call a methodchannel from flutter to Android When the var accountToken=await platform.invokeMethod("ccAvenuePayment", {"params": jsonEncode(payment.toJson())}); I am getting a crash in the log and…
RagAnt
  • 1,064
  • 2
  • 17
  • 35
0
votes
2 answers

How to pass response from delegate function to flutter in Swift?

I am trying to implement the payment SDK in flutter, it working successfully in Android side and getting trouble to implement the same in iOS. After the successful payment I am getting the response in func qpResponse(_ response: NSDictionary) { …
afsal.an
  • 499
  • 2
  • 6
  • 13
0
votes
1 answer

How to integrate Siri into Flutter with MethodChannels?

I want to integrate Sirikit into my flutter application. Therefore I have to establish a MethodChannel for communication between the host and the client. I want the iOS-side to invoke a flutter function and that response be Siris answer. This is the…
Phil
  • 321
  • 1
  • 17
0
votes
1 answer

Flutter Send message using methodChannel from android native code to dart

I am trying to send message using methodChannel from MainActivity to dart code and everything is ok when the app is open or is in the recent apps,but when I deattach the app, dart code couldn't receive anything from method Channel, Please can anyone…
0
votes
1 answer

How do I move/copy a file from cache to the user's documents directory? [Swift, Flutter]

I have downloaded a file in Flutter and using the path_provider package, placed it in the directory I get from getTemporaryDirectory(). Then calling a method using MethodChannels, I am calling the following method: private func saveDocument(_…
0
votes
1 answer

Synchronous platform code execution in Flutter

I am calling a native SDK which goes off and does some API calls, which is obviously time-bound work. For 90% of this work I am using callbacks and method channel calls going bi-directional so Dart can call Swift, and Swift can then call Dart when…
aspirant_sensei
  • 1,568
  • 1
  • 16
  • 36
0
votes
1 answer

How do I integrate flutter_bloc with method channels?

I've started using flutter_bloc package instead of redux to try it out, but I'm not entirely sure how I'm going to call flutter bloc events when receiving things from native (Android/iOS). It was easier with redux because in my parent MyApp widget…
Johnny Boy
  • 790
  • 3
  • 7
  • 18
0
votes
1 answer

How to use a Flutter page in a custom Android Activity or Fragment?

I am working on a project where an old library is being used in Android natively. Because of this, I am forced to work in Kotlin and use a xml file in order to view some elements on the screen. However, I am questioning myself if there is a way to…
Logan
  • 93
  • 9
0
votes
1 answer

Flutter MethodCall non-nil check in kotlin way

I tried to make a MethodCall type judgement function using kotlin, but it return a type mismatch for me, how should I fix with it? import java.util.Objects import io.flutter.plugin.common.MethodCall class Utils private constructor() { …
ccd
  • 5,788
  • 10
  • 46
  • 96
0
votes
1 answer

Fetch arguments in Flutter module

I have a native Android app. I imported a Flutter module. Now, I can successfully navigate to the selected route from my Android app. I know passing data between native and flutter side is by method channels. But I did not understand how to…
Akif
  • 7,098
  • 7
  • 27
  • 53
1 2 3
9
10