How to set resource-id/content-desc in flutter app for automation using Appium? - flutter

To automate flutter app using Appium, we need to set the resource-id (for Android) and accessibility-Id/content-desc (for iOS) of any element/control in the flutter app. To get resource-id and accessibility-Id in the Appium tree view of flutter app, what should be done? Please help with possible solutions to achieve this.
Please refer below screenshot of Appium tree view which shows the missing resource-id.
Flutter version = 1.17.5
Please take a note that we have already tried "key" property of Widget for unique identification but it didn't work.

You can check this thread about Flutter support for Appium.
You can use semanticLabel field, but it still feels like Flutter driver for Appium is far from stable state.

Related

Is it possible to create a custom share sheet in Flutter?

I want to build this custom share sheet shown in the screenshot depending on the apps that are on the mobile, could anyone tell me if it's possible? screenshot
i am currently using flutter's share_plus package, but the share method summons the platform's share sheet, is it possible to customize my own share sheet and use it for both platforms android and ios?
Using the Flutter Availability package you can customize this by styling BottomSheet from scratch. Still, this package is only for Android devices. Unfortunately, iOS does not provide any API to get the installed APPs information.
I guess You'll have to work with a modalBottomSheet and https://pub.dev/packages/url_launcher
You can check if an application is installed, but this would work only for android Is there any way to identify that a particular application is installed in my android/ios device through flutter and dart?

Flutter: MissingPluginException when calling plugin from isolate spawned by native code

I'm building a Flutter app that will have the capability to execute some actions when the device connects to another bluetooth device. This app should work on Android and iOS but for the sake of simplicity I'll focus on Android in this post. Also, this has to work whether the app is in the foreground, in the background or killed.
Here is the architecture of the app:
I have an Android native code that registers to bluetooth events through a BroadcastReceiver.
I followed this tutorial to set up the communication between the Android code and the Flutter code: https://medium.com/#chetan882777/initiating-calls-to-dart-from-the-native-side-in-the-background-with-flutter-plugin-7d46aed32c47.
When the Android BroadcastReceiver is triggered by a bluetooth event, the information is sent to the Flutter code (even if the app was in the background or killed). A Flutter isolate is created to handle the Flutter code.
Everything works perfectly well. The Flutter code is called and I can use print(data) to log the data that have been provided by the Android code.
Things are becoming more tricky when, from the isolate, I want to call any Flutter plugin (like sqflite, package_info_plus, ...). I get this error every time:
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception:
MissingPluginException(No implementation found for method xxx on
channel yyy)
I understand that spawned isolate can't natively run Flutter plugins. There are some posts (Unable to understand Flutter Isolate workaround for "'Window_sendPlatformMessage' (4 arguments) cannot be found" error, https://github.com/flutter/flutter/issues/13937) that explain how to create isolates that can run Flutter plugins by using a workaround or a plugin like https://pub.dev/packages/flutter_isolate.
However, I can't create the isolate with this package because the isolate is created from the Android code.
Can one of you tell me how I can achieve this? Is there a way to use Flutter plugins from an isolate that has been created by native code?
Thank you very much in advance
Sounds like the way you create the Flutter isolate may not be compatible with your goal. There are some solutions to integrate Flutter with native Android/iOS projects, such as flutter_boost (disclaimer: I have not tried it and not sure good or not; you may find many other alternatives as well, this is just an example). You can use that to create the Flutter environments. Since the solutions above allow some Android code to open a new normal Flutter page and Flutter code in that page is able to do anything (of course include calling native - otherwise things like flutter_boost is really useless), this should work.

Flutter Detect Notification Tray Pulldown

I'm trying to implement a feature based on the background/foreground status of a Flutter app.
Does anyone know of a way to detect if the notification/system try on a device is pulled down over the app?
Thanks.
Welcome to SOF
You can detect this using special permission in Android (https://developer.android.com/reference/android/Manifest.permission#EXPAND_STATUS_BAR).
But you need native code to run in Flutter.
There is a similar (almost) package out there, you may fork it:
https://pub.dev/packages/notification_shade

Flutter printing invoice to usb printer in desktop app

I'm working on flutter desktop app and i need to print invoice to USB printer.
https://pub.flutter-io.cn/packages/printing
Currently i m using this plugin but not working, it only shows pdf view with loading indicator only. not loading the invoice view i created.
https://pub.dev/packages/flutter_usb_write. This is another plugin i've tried so far but when running the app is shows exception stated unable to find method implementation for detecting usb connected devices.
Please help me solving this issues or suggest me some another solution or plugin.
Thanx.
Flutter desktop has been launched as stable earlier this year. Perhaps you may want to try running a desktop build again using the latest Flutter version. Simply run flutter upgrade to update the Flutter version that you're running on. Currently, the printing plugin is one of the stable printer plugins on Flutter.
If the issue persists, please include the logs from the app. This should give indicators if the app is able to communicate with the printer or if there's any issues with the document that you're trying to print.

Flutter drag and drop inside UI in desktop application

Talking about a desktop application now, not mobile or web.
Is it any widget in Flutter that will allow, for example, drag a folder, drop it in the application UI, and the app will read for example the path to that file or folder?
I have been reading about Draggable and DragTarget in Flutter, but i do think they are used for that purpose.
NOTE: it might not exist a widget for that purpose, so a strategy on how to do that in Flutter will also be appreciated.
Assuming you're talking about dragging from outside the application, it's not currently supported; Flutter #30719 would be the issue to watch/upvote.
Depending on the specific platform you might be able to implement it with a plugin in the short term (if you are familiar with native development on that platform), but that would likely be more work than contributing an implementation to Flutter itself.
Flutter has a dependency to support such behavior now. Check this link
https://pub.dev/packages/desktop_drop