at_widgets
                                
                                 at_widgets copied to clipboard
                                
                                    at_widgets copied to clipboard
                            
                            
                            
                        packages depending on fluttertoast are being a blocker for the apps/widgets which use file_picker/image_picker in iOS
Which at_widget package you find issue with?
at_location_flutter
On what platforms did you experience the issue?
iOS
What version are you using?
at_location_flutter: ^3.1.6
What happened?
Because of the fluttertoast used in at_location_flutter, we cannot pick any file from iCloud. Either the fluttertoast can be a direct dependency or a transitive dependency the issue exists. I have raised a ticket regarding this issue. https://github.com/miguelpruivo/flutter_file_picker/issues/1003,
https://github.com/flutter/flutter/issues/105919
Steps to reproduce
- Create an at_app.
- Add at_location_flutter package.
- Add any file upload/file picking functionality.
- Run flutter pub getandcd ios && pod install.
- Run flutter run
Additional info
fluttertoast is the culprit. Happened in the new Buzz application.
Relevant log output
Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                           42.8s
Failed to build iOS app
Error output from Xcode build:
↳
    2022-07-05 14:03:52.884 xcodebuild[70039:1351108] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    2022-07-05 14:03:52.884 xcodebuild[70039:1351108] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **
Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/pc/8zz9zy_d5jxctzt7xq13z6740000gn/T/flutter_tools.RzbbZx/flutter_ios_build_temp_dirKj7Uvl/temporary_xcresult_bundle
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:39:52: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDataSource: class {
                                                       ^~~~~
                                                       AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:55:50: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDelegate: class {
                                                     ^~~~~
                                                     AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:39:52: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDataSource: class {
                                                       ^~~~~
                                                       AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:55:50: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDelegate: class {
                                                     ^~~~~
                                                     AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:39:52: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDataSource: class {
                                                       ^~~~~
                                                       AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:55:50: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDelegate: class {
                                                     ^~~~~
                                                     AnyObject
    /Users/minnu/Desktop/buzz/ios/Runner/GeneratedPluginRegistrant.m:72:9: fatal error: module 'fluttertoast' not found
    @import fluttertoast;
     ~~~~~~~^~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/minnu/Desktop/buzz/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'Toast' from project 'Pods')
    /Users/minnu/Desktop/buzz/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'FMDB' from project 'Pods')
    Result bundle written to path:
    	/var/folders/pc/8zz9zy_d5jxctzt7xq13z6740000gn/T/flutter_tools.RzbbZx/flutter_ios_build_temp_dirKj7Uvl/temporary_xcresult_bundle
Parse Issue (Xcode): Module 'fluttertoast' not found
/Users/minnu/Desktop/buzz/ios/Runner/GeneratedPluginRegistrant.m:71:8
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited
Flutter analyze output
No response
Flutter doctor output
No response
Solution I propose
Make use of ScaffoldMessenger and make custom toasts.
Additional Info
I see them in
- at_theme_flutter
- at_events_flutter
- at_location_flutter
- at_contacts_group_flutter
I see you raised an issue on the fluttertoast repo. Let's wait to hear back from the fluttertoast maintainer if they can resolve the issue. Alternatively, if you know how to resolve the issue, you could do the fix and test it and submit a PR to FlutterToast
@gkc Yes, I did raise it in the rest of the repos that were being blocked by this package. Sadly I don't know the solution cause no traces were being found. So need to wait. And also this is a blocker for all the apps that use the above packages I mentioned. They can't move forward. They will get stuck on onboarding itself. I will wait for it and need to be discussed what to do in this scenario. Thanks.
What's latest on this @yahu1031 ?
@gkc Currently, no work is seen on that ticket. And also no activity was found. There was a solution that needs to be done from our side. That is, Remove the fluttertoast from the packages and create our own custom toasts with ScaffoldMessanger. We can create a package and use it.
@yahu1031 I'm reassigning priority to high, so we can add to PR43 or PR44
@sonle-geekyants @sachins-geekyants @nitesh2599 Any idea or updates?
void showToast(BuildContext? context, String msg,
        {double? width, bool isError = false}) =>
    ScaffoldMessenger.of(context!).showSnackBar(
      SnackBar(
        content: Text(
          msg,
          textAlign: TextAlign.center,
          style: TextStyle(
            fontSize: 12,
            color: isError ? Colors.white : Colors.black,
          ),
        ),
        duration: const Duration(milliseconds: 3000),
        elevation: 0,
        margin: width != null
            ? null
            : EdgeInsets.symmetric(
                horizontal: MediaQuery.of(context).size.width * 0.2),
        backgroundColor: isError
            ? Colors.red[700]
            : Colors.white,
        padding: const EdgeInsets.all(10),
        width: width,
        behavior: SnackBarBehavior.floating,
        shape: RoundedRectangleBorder(
          borderRadius: Platform.isAndroid
              ? BorderRadius.circular(50)
              : BorderRadius.circular(10),
        ),
      ),
    );
This code block will show the toast same as now. So we can get rid of flutter toast package. LMK what do you think.
@yahu1031 Are we replacing toast message with snackbar ?
May be. I suggest to do so.
@Pritam-deb please test this branch by Minnu : https://github.com/atsign-foundation/at_widgets/tree/toast_fix
Where flutter toast is replaced by snackbar.
Moving this ticket requires validation
The text can be a bit bigger. The toast could also pop a bit higher.
@Pritam-deb can you share screenshots of both the UI? it will be easier to compare.
@Pritam-deb Toast has fontSize and gravity properties now.
minnu customToast.webm This is branch on which @yahu1031 worked in. flutterToast.webm Here, I have used FlutterToast here
Hence, looks good enough.
@Pritam-deb This issue from the fluttertoast seems fixed, Cross check this with fluttertoast package, If it works, use it. https://github.com/ponnamkarthik/FlutterToast/issues/391#event-7594635351