It's snowing for Christmas in cities all over the world, including Honolulu. At an expert conference, the viewpoint character says "It never snows in Hawaii."
I stopped reading.
An expert would know that it snows in Hawaii. At rather high elevations, not every winter, and not enough for safe skiing; but it does snow in Hawaii.
It is barely, barely possible an expert talking down to laymen would say that. But not when talking to fellow experts.
The story is Connie Willis's "Just Like The Ones We Used to Know." I still read sf and fantasy by her -- but I don't count on her to get her facts right. And if it's a kind of story which depends on factual accuracy (for example, set in the past), I don't read it.
How do you get expert speech right? Run it past that kind of expert.
Now: let's say you have reason to consider yourself well informed about politics. You're a well-read conservative or a well-read liberal. Your character is of the opposite persuasion; but you know exactly how Those People talk and write.
No. You don't. Unless you're a professional linguist and this is your area of research.
If you aren't, consult people of that political persuasion. That EXACT political persuasion, of course.
Or you're writing a character who grew up where and when I did. You know me, and you've listened to me enough to know how such a character would talk.
Bad news -- there may be sounds you don't hear.
Some Americans and Canadians pronounce "Aaron" and "Erin" identically, and find it difficult to hear the difference when I say these names. Most Americans pronounce "horse" and "hoarse" identically; I don't.
If you're English, and you speak Received Pronunciation or a London-area dialect, you're likely to have trouble hearing when Americans do or don't pronounce r-sounds at the ends of syllables. (That's real, genuine R's; not the sound Ian Fleming meant when he said Americans pronounced his name "Iarn.")
And: there are people who clearly remember me saying I grew up in a small town. No. I grew up in the country. There are places where "It's the same thing, isn't it?" -- but Ulster County NY isn't one of them. (Or wasn't.)
The good news: Dialecticians and theatrical coaches have produced written and audio material on dialects.
But it's still a good idea to have at least one native speaker look over what you've written.
But what if you story is set in the future? I know of one useful reference work: Allan Metcalf, Predicting New Words: The Secret of Their Success; Houghton Mifflin, 2002; ISBN 0-618-13006-3.