Visual detection of analytes has been a significant challenge in the design and development of optical chemosensors. Sensing of analytes in aqueous solution by organic molecules has encountered some issues, such as poor water solubility and quenching of optical properties. In this study, a new category of smart dendritic macromolecules was designed and synthesized by functionalization of the poly(amidoamine) (PAMAM) dendrimer with spiropyran molecules to afford a photoluminescent dendritic structure (SP-PAMAM). Smart optical sensors were prepared by physical incorporation of four different oxazolidine derivatives containing hydroxyl and nitro substituted groups into the SP-PAMAM structure. Investigation of optical properties demonstrated photoinduced electron transfer (PET) between the spiropyran end group of SP-PAMAM and oxazolidine derivatives (in a concentration of about 0.0002 M), which can result in quenching of fluorescence emission of spiropyran photoswitch in the form of merocyanine (MC). Treatment of the oxazolidinedoped SP-PAMAM samples with metal ions resulted in changes in the PET mechanism (switching on or off), as observed in the case of Fe 3+ , Pb 2+ , Cu 2+ , Zn 2+ , Cd 2+ , Co 2+ , and Ni 2+ by different oxazolidine derivatives through various mechanisms (increase or decrease of fluorescence emission). These smart photoluminescent dendritic macromolecules have potential applications for photodetection of metal ions in aqueous media as optical chemosensors. In addition, the smart macromolecules displayed disconnection of PET between MC and oxazolidine and also showed red fluorescence emission under acidic conditions (pH 1−5). It is due to the protonation of the MC to MCH form and demonstrates a remarkable red shift in fluorescence spectra. The pH-responsivity of smart macromolecules was used for designing a paper-based pH indicator for visual detection of spoilage in the food industry, especially in the case of milk. The prepared papers applied on cap of the milk bottles did not show any fluorescence emission in the case of fresh milk; however, a red fluorescence emission was observed after milk spoilage as a result of adsorption of acidic volatile components generated by bacterial degradation and oxidation process on the paper surface. The reported smart papers can serve as optical portable pH indicators for timely detection of spoilage in food materials, which are usable in food packaging as smart indicator tags.