flutter-plugin

How to use Flutter Method Channel in background (app minimised/closed)

老子叫甜甜 提交于 2020-08-10 19:32:37
问题 I am working on a native Android widget in a Flutter App. In which there is refresh button, on click of that I have to call a method in the Flutter code. I am using Flutter Method Channel for the communication and it is working fine when app is in foreground. But it does not work when app is minimised or closed. I get error PlatformException(NO_ACTIVITY, null, null) . Below is my code. Android (AppWidgetProvider) if (methodChannel == null && context != null) { FlutterMain.startInitialization

How to use Flutter Method Channel in background (app minimised/closed)

家住魔仙堡 提交于 2020-08-10 19:32:05
问题 I am working on a native Android widget in a Flutter App. In which there is refresh button, on click of that I have to call a method in the Flutter code. I am using Flutter Method Channel for the communication and it is working fine when app is in foreground. But it does not work when app is minimised or closed. I get error PlatformException(NO_ACTIVITY, null, null) . Below is my code. Android (AppWidgetProvider) if (methodChannel == null && context != null) { FlutterMain.startInitialization

Flutter plugin constructor in class cannot be applied to given types

有些话、适合烂在心里 提交于 2020-07-19 06:03:12
问题 I'm trying to build a simple speech to text application which should continuously listen. Therefore I searched pub.dev for a fitting plugin but unfortunately, there aren't any like that. So the next step would be to integrate it by myself natively. There is one plugin for android called "Droid Speech 2.0"(kotlin). I successfully integrated into a normal android kotlin project. Now I'm trying to build a flutter plugin for me and thought about using platform channels. But because I don't have

Flutter plugin `geolocator-Swift.h` file not found

我与影子孤独终老i 提交于 2020-06-24 12:33:08
问题 I have created a small Flutter plugin which can be used to monitor location changes in you Flutter application (source: https://github.com/baseflowit/flutter-geolocator). After extensive testing using the example project that is part of the project structure (as generated by the Flutter CLI) we decided to publish the plugin to make it available to the world. Now we received some feedback that when you include the package from the online Dart Packages repo into your Flutter App, the iOS

Get activity reference in flutter plugin

北城以北 提交于 2020-06-17 01:00:51
问题 When I created a flutter plugin, there are two methods in the plugin class by default: override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) and fun registerWith(registrar: Registrar) The comment on the file says : It is encouraged to share logic between onAttachedToEngine and registerWith to keep them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called depending on the user's project. onAttachedToEngine or registerWith

How to open flutter plugins at Xcode?

故事扮演 提交于 2020-05-23 11:01:27
问题 I want make some changes in plugin. For android part everything is clear. But how can I open iOs part of plugin? There are no Xcode project just several .h and .m files. How to open iOs plugin at Xcode? https://github.com/flutter/plugins/tree/master/packages/video_player/video_player/ios 回答1: First, be sure to run the example app at least once. $ cd example $ flutter run Then open the project in Xcode. The Xcode project is in example/ios . The swift (or obj-c) code that implements the iOS end

Flutter: E/location_permissions: result object is null in Geolocator plugin

僤鯓⒐⒋嵵緔 提交于 2020-04-30 06:57:07
问题 I am using Geolocator plugin in Flutter Project. I have added it Pubspecs.yaml file also added the permission in AndroidManifest file. Pubspecs.yaml dependencies: http: ^0.12.0 flutter: sdk: flutter shimmer: ^1.0.1 font_awesome_flutter: ^8.8.1 geocoder: ^0.2.1 geolocator: ^5.3.1 Android Manifest <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> I am using SDK 28 - compileSdkVersion 28 Here is

Update flutter dependencies in /.pub-cache

早过忘川 提交于 2020-03-14 11:00:06
问题 I erased in my folder .pub-cache/hosted/pub.dartlang.org/this_plugin What is the command to update the dependencies inside pubsec.yaml ? I believe it is flutter packages get The folder under .pub-cache is still not up to date. Note: there was a pubspec.lock that I deleted 回答1: Remove the package from dependencies in pubspec.yaml , run flutter packages get . And then add the package to dependencies again and running flutter packages get .This process has solved the problem for me in the past.

Is there, in flutter, a way of calling an init function in the plugin automatically on startup of an app?

不羁的心 提交于 2020-03-05 03:06:08
问题 Since this is a flutter plugin, I don't want developers depending on the plugin to have to init the plugin in anyway. Maybe they'll have to, but I'd really like for them not to have to. Basically, I want a way of calling the _channel.setMethodCallHandler method automatically when the app depending on the plugin starts. Without other developers having to do so, for instance calling a static method living in the DragndropPlugin class, themselves to "initialize" the plugin. Maybe there are some

How to use local aar inside flutter plugin?

大城市里の小女人 提交于 2020-01-31 03:58:48
问题 I've create a flutter plugin with: flutter create --template plugin flutter_plugin I've put my aar file inside flutter_plugin/android/src/main/libs folder I've modified flutter_plugin/android/build.gradle and changed rootProject.allprojects section to rootProject.allprojects { repositories { google() jcenter() flatDir { dirs "src/main/libs" } } } And added dependencies section, after android {}: dependencies { implementation (name:"mylib",ext:"aar") } but when i try running with: flutter run