Flapping is a feature which is associated with the English of Canada and the United States. However, it does also occur in parts of England such as the southwestern part known as the West Country. It also occurs in the English of Australia and New Zealand as well as in other parts of the world.
Vowel raising is a feature that is characteristic of Canadian English but also occurs in parts of the USA such as in Minnesota. For most Americans, the words "writer" and "rider" are identical, but for most Canadians they are different. The word "writer" preserves the raised vowel of "write".
Two phonological rules are associated with Canadian and American dialects which preserve a distinction between "writer" and "rider". They are vowel raising and flapping. The ordering of the two rules is considered important. If no distinction is maintained, flapping applies first. When flapping applies first, the voiceless alveolar plosive becomes a voiced alveolar flap. Since vowel raising must occur before a voiceless consonant, this takes away the environment necessary for vowel raising. We can say that flapping bleeds vowel raising. In other words, when flapping is applied first, the rule for vowel raising is blocked.
However, in the dialects which maintain a distinction between "writer" and "rider", vowel raising applies first. This is the case in the word "writer". The vowel raises in the word "write" to which the agentive suffix -er is attached. After the vowel raises, the voiceless alveolar plosive, between a stressed vowel and an unstressed vowel, becomes a flap.
In those dialects which distinguish between "writer" and "rider", the words "spider" and "rider" do not rhyme. Morphology is needed to explain this phenomenon. The word "rider" consists of the morphemes ride + -er. In the word "rider", the diphthong of "ride" is preserved. "Spider", however, consists of a single morpheme. The voiced alveolar plosive is flapped and vowel raising applies. It is curious, though, that vowel raising applies here because "spider" does not have a voiceless alveolar plosive. It thus appears that vowel raising can occur wherever an alveolar plosive is flapped. In the case of words such as "rider", vowel raising does not occur because vowel raising does not occur in the root "ride".
The examples of "spider" and "rider" appear to show that the analysis with the rules of vowel raising and flapping is simplistic. If this analysis were sufficient, the vowel raising in words such as "spider" could not be explained. It is necessary to include morphological information to explain forms such as "rider" in which vowel raising does not occur in those dialects with vowel raising. Though "spider" has no voiceless alveolar plosive, all alveolar plosives can flap between a stressed vowel and an unstressed one. A better account of dialects which distinguish between words such as "writer" and "rider" is simply to state that vowel raising is regular before flaps unless the word has a root with a voiced alveolar plosive to prevent vowel raising.