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.
Questions tagged [flutter-method-channel]
146 questions
3
votes
0 answers
Flutter on Android: can I call a custom MethodChannel while the app is in the background?
I have created a custom MethodChannel "com.example.app/widget" that updates a home screen widget on Android after receiving a Firebase Cloud Message. It runs fine when it is called while the app is in the foreground, but I would also like to call it…

8will
- 51
- 6
3
votes
1 answer
Flutter setMethodCallHandler not call its argument
iam trying to open a flutter screen from native android
so iam trying to use MethodChannel for returning data to dart then invoke method that's gonna navigate me to the current screen
but my code is not working
this is my code
@Override
public void…

Muhammad
- 601
- 2
- 9
- 18
3
votes
2 answers
How to call Dart from Android in background
I'm trying to call Dart code from Android when either the Activity is in de background or when there is no activity at all. For example, when the alarmmanager has triggered.
This is my dart code:
void main() async {
…

Robin Dijkhof
- 18,665
- 11
- 65
- 116
3
votes
3 answers
Type mismatch: inferred type is MainActivity but FlutterEngine was expected
I am new on flutter and I want change wallpaper of the device but that needs Method calls from platform channel
https://developer.android.com/reference/android/Manifest.permission?hl=en#SET_WALLPAPER
and
native android wallpaperManager
under the…

Ihsan ALGUL
- 41
- 1
- 1
- 6
3
votes
0 answers
How to call an argument from Java to Dart using MethodChannel?
I am trying to call an argument from my Java native code to Dart,
I have a method in my Java code -
@Override
public void onReward(final int quantity) {
HashMap args = new HashMap<>();
args.put("reward",quantity);
…

Arnav
- 1,404
- 2
- 19
- 38
3
votes
1 answer
How to call a platform code from an isolate in flutter?
I know these libraries flutter_isolate and isolate_handler exist that support doing these but I couldn't find any method to call platform specific codes from inside of them. Can someone show any example of how it's done ?

xyron
- 75
- 1
- 2
- 6
3
votes
2 answers
Flutter MethodChannel from iOS to Native not working
I have a Flutter project trying to establish two-way communication between Flutter and iOS Native. So far it's working perfectly from Flutter to iOS, but the other way around it's silent. When I call the method from iOS, nothing happens. No message,…

Kenneth
- 3,957
- 8
- 39
- 62
2
votes
1 answer
Event channel is not working as expected between flutter and kotlin
I did a plugin in native code(Kotlin) and tried to use that in a Flutter application. I used a method channel for Flutter to native code communication and an event channel for native code to Flutter. Method channel communication is working properly,…

Kugesh Rajasekaran
- 127
- 2
- 9
2
votes
0 answers
Flutter MethodChannel from android to flutter not working
I have a Flutter app with 2 screens. First is "IntroPage" and second is "MainPage".
I have run same channel and same code in these 2 screens for communicating to android native.
But in MainPage everything works correctly, but in IntroPage when I…

Mohamadamin
- 564
- 5
- 16
2
votes
1 answer
How to send a list of data from flutter to android java method channels or eventChannels?
void sendData() async {
final session = StateInheritedWidget.of(context).state.session;
String Datas;
try {
final String result = await sendData.invokeMethod(
'sendData',{"bVolt":1.5,"hstring":2.5,
…

Nns_ninteyFIve
- 439
- 4
- 12
2
votes
1 answer
Flutter Bad State: Stream has already been listened to
I am trying to use methodChannel in flutter to receive events from native Android code. But once I cancel the stream subscription I can no longer create new subscriptons even if I set the stream asBroadcastStream()
Receiver.dart
static…

Just a Person
- 1,276
- 1
- 5
- 23
2
votes
0 answers
Flutter: MissingPluginException when I call platform channel from spawned isolate using isolate_handler package
When I want to call a method channel from a spawned isolate using isolate_handler (because it doesn't work using dart's isolates), I get a MissingPluginException which doesn't happen when calling method channel from the main isolate.
class…

Dusan Milosevic
- 59
- 4
2
votes
0 answers
i am trying to use method channel to access camera and take photo , but how can i get the file from method channel respons
package com.example.unit_testing
import android.content.Intent
import android.graphics.Bitmap
import android.provider.MediaStore
import android.view.WindowManager.LayoutParams
import androidx.annotation.NonNull
import…

Jinto Joseph
- 947
- 6
- 23
2
votes
1 answer
Flutter - how to run a process at a specific time even if the app is in background (like an alarm app)
I'm software engineer using Flutter in Japan.
Developing an alarm app that wakes me up in the morning, and having trouble implementing the following.
I would appreciate it if you could help me.
Question.
I would like to know if there is a way to…

Ayumi Sashitani
- 31
- 4
2
votes
1 answer
Why does MethodChannel.Result.success() sometimes cause a timeout at Flutter?
I'm having a simple Flutter plugin that communicates through a MethodChannel with some native Android code. Here's a simple example how the methods provided by the plugin look like:
Future doSomethingImportant(int address, SomeImportantData…

SePröbläm
- 5,142
- 6
- 31
- 45