Mandarin Chinese is official language in China which is based on Beijing's dialect, that means few people use mandarin in their daily life except ones in Beijing, but in fact, almost every Chinese can understand you if you say mandarin, 'cause it's a standard. in our daily life, we often use our own accent, such as Cantonese, Shanghaiese, Taiwanese, etc. if you want to live in China, you should learn a bit local dialect except mandarin which can make you more approachable and humorous.
e.g. if you live in northeastern China, you can use "哎呀妈呀" instead of Oh My God. very interesting.
if you ask me which one is the most widely spoken, only Mandarin.