Flutter Desktop: How to handle Native Code editing in an IDE (Intellisense, Autocompletion, etc.)?


I am an absolute beginner to C++. I am working with a Flutter Desktop Plugin. Everything is fine just I am unable to configure native code editing properly (Intellisense, Autocompletion, etc.) as it’s just acting as a plain text. I have a linux named directory in my flutter project, it seems to be a C++ project. How do I work with this code with full IDE support? I tried to open the linux named folder in CLion and got this.

CMake Error at CMakeLists.txt:12 (apply_standard_settings):
  Unknown CMake command "apply_standard_settings".

-- Configuring incomplete, errors occurred!

Here’s CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME "desktop_practice")

# This value is used when generating builds using this plugin, so it must
# not be changed
set(PLUGIN_NAME "desktop_practice_plugin")

add_library(${PLUGIN_NAME} SHARED
set_target_properties(${PLUGIN_NAME} PROPERTIES
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)

# List of absolute paths to libraries that should be bundled with the plugin

Even I tried to open the project in VSCode but I couldn’t configure it as a proper C++ project.


You said you’re working on an application, but you’ve shown the CMakeLists.txt for a plugin. As on mobile, desktop Flutter plugins aren’t stand-alone buildable projects; they are meant to be built in the context of an application. That’s why opening it directly gives you a missing command.

When editing a plugin, you should be opening/building the example application created as part of the plugin project.

Answered By – smorgan

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.