skip to Main Content

I’m trying to build a Flutter Windows application with the firebase_auth plugin, but the build fails consistently with the following error:

C:UsersGabrielDownloadsProjectsmcpark-updatemcparkwindowsflutterephemeralcpp_client_wrapperincludeflutterencodable_value.h(199,60): error C2665: 'std::variant<std::monostate,bool,int32_t,int64_t,double,std::string,std::vector<uint8_t,std::allocator<uint8_t>>,std::vector<int32_t,std::allocator<int>>,std::vector<int64_t,std::allocator<int64_t>>,std::vector<double,std::allocator<double>>,flutter::EncodableList,flutter::EncodableMap,flutter::CustomEncodableValue,std::vector<float,std::allocator<float>>>::variant': no overloaded function could convert all the argument types

Steps Taken So Far:
Modified encodable_value.h:
I removed std::vector from the std::variant declaration in the dynamically generated file:

C:UsersGabrielDownloadsProjectsmcpark-updatemcparkwindowsflutterephemeralcpp_client_wrapperincludeflutterencodable_value.h

Modified the Source File in Flutter SDK:
I also modified the source encodable_value.h in the Flutter SDK:

C:UsersGabrielflutter_windows_3.19.6-stableflutterbincacheartifactsenginewindows-x64cpp_client_wrapperincludeflutterencodable_value.h

Ensured C++17 Standard:
I added the following to my CMakeLists.txt to enforce the C++17 standard:

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Downgraded firebase_auth:
Tried several versions of firebase_auth, including ^4.16.0 and ^5.3.4, but the error persists.

Reinstalled Dependencies and Tools:

Deleted and reinstalled the Flutter SDK (version 3.19.6).
Verified that Visual Studio is installed with:
MSVC v143 Build Tools
Windows 11 SDK (10.0.22621.0)
C++ CMake Tools

It doesn’t happen the same when building for Mobile.

Environment Details:
Flutter: 3.19.6
Dart: 3.3.4
firebase_auth: Tried both ^4.16.0 and ^5.3.4
Visual Studio: 2022, with required components installed
OS: Windows 11

2

Answers


  1. I don’t pretend this will answer the exact same problem described here, but I’m posting what I did to solve my problem when the same error happened to me with Flutter.

    In my case, my project was made by two apps that ran on different platforms, and they had a "shared" flutter package that handled some common classes and code. Basically, since they both interacted with Google Firestore and with the same data, it seemed logical to create a common codebase for read/write operations.
    Well, all was running just fine until we moved the firebase_auth package into the shared project: as soon as we did this, the Windows app gave the above error and simply didn’t run anymore. The only way to make it work again was to remove the plugin from the shared project and put it back in the "main" windows app.

    We’ll be checking now if it’s a known issue, but I’m gonna leave this here for the random user searching the web for this error, hoping it might help.

    EDIT: the issue was known

    Login or Signup to reply.
  2. Downgrade Visual Studio to 17.11.5 and dotnet to 8.0.403

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search