Two-dimensional (2D) graphdiyne (GDY) is a promising floating-gate material for flexible optoelectronic flash memory owing to its fascinating electrical and optical properties. However, research in GDY-based flash memory is still in its infancy owing to the huge challenge in the synthesis of large-area and ultrathin GDY films with high quality and uniformity. Here, an electric double-layer-confined strategy is proposed to synthesize a wafer-scale GDY film with thickness of 1 nm. Then, a two-terminal top-floating-gated optoelectronic memory with multibit storage capability is investigated using GDY as a photoresponsive top-floating gate. Benefiting from the excellent charge storage capability and high photoresponse of GDY, this device exhibits over 256 distinct storage levels (8 bits) with signal-to-noise ratios larger than 100. Moreover, the fully 2D material and two-terminal architecture endows the device with robust bending stability for over 1,000 bending circles, paving the way to develop wearable electronics.