Since 2.24add_Adds a value to the variant being built.
The value to add (must match the expected element type)
Since 2.24closeCloses the current container being built.
Since 2.24endSince 2.24openOpens a new subcontainer of the specified type.
The type of the subcontainer to open
Since 2.24refSince 2.24unrefStaticnewCreates a new VariantBuilder for the specified type.
The type of variant to build
A new VariantBuilder instance
A utility class for building complex GVariant structures incrementally.
VariantBuilder is useful when you need to construct variants dynamically or when dealing with complex nested structures. It provides a way to build variants step by step rather than constructing the entire structure at once.
Example