A method of synthesizing a biocompatible hydrogel by covalently cross-linking an effective amount of a first macromonomer including a cyclic thioester group with an effective amount of a second macromonomer including a terminal cysteine group is disclosed. In addition, the synthesis and use of the following specific cyclic thioester macromonomer that can be used in the method, as well as specific hydrogels made using this macromonomer are disclosed. The disclosed method produces a biocompatible hydrogel, while producing substantially no toxic free thiol by-product. Accordingly, the method can be used in making biomedical products, such as sutures and tissue replacement biomaterials, and for encapsulating therapeutic cells and pharmaceuticals.