History of Scottish Gaelic
All surviving dialects are Highland and/or Hebridean dialects. Dialects of Lowland Gaelic have become defunct since the demise of Galwegian Gaelic, originally spoken in Galloway, which seems to have been the last Lowland dialect and which survived into the Modern Period. By the 18th century Lowland Gaelic had been largely replaced by Lowland Scots across much of Lowland Scotland. According to a reference in "The Carrick Covenanters " by James Crichton, the last place in the Lowlands where Scottish Gaelic was still spoken was the village of Barr in Carrick: only a few miles inland to the east of Girvan, but at one time very isolated. Crichton gives neither date nor details.
Goidelic languages
Despite the ascent in Ireland of the English and Anglicised ruling classes following the 1607 Flight of the Earls (and the disappearance of much of the Gaelic nobility), Irish was spoken by the majority of the population until the Great Famine of the 1840s. Disproportionately affecting the classes among whom Irish was the primary spoken language, famine and emigration precipitated a steep decline in native speakers which only recently has begun to reverse.