My Code’s Not Good! Know Why?

Greg Perry
18 min readJun 27, 2019

Making a Dart package suitable for public use.

No more than four days after publishing my article concerning the Dart package, ads, that utilized Google’s own plugin, firebase_admob, to add Ads to your Flutter app, I’ve began writing another article on somewhat the same subject. I didn’t like the Dart package you see. Now, why was that?

Well, because, as I explained at the end of my previous article, Add Ads to your App in a Snap!, there’s some things one must consider when supplying a program for ‘public consumption’ as it were. I hinted there were some things still outstanding that needed to be addressed. Well, four days on, they’ve been addressed. Again, this was concerns the Dart package, ads. I’ve made it better. That’s why.

For Public Consumption

I made it better to be used in production with unknown mobile apps. I had initially chosen it to be a Utility Class using much of the Singleton design pattern approach when developing this Dart package. In other words, the class was made up of a series of public static properties and public static functions that you can then access application-wide simply by using the class name as prefix, ‘Ads.’ By it’s very nature, there’s only one instance of it as it’s not meant to be instantiated. However, such a class is not without certain considerations. Ones that needed to be addressed with regards to the purpose of this particular class. It was to utilize a Google plugin involving Admob ads. Ads for a lone mobile app.

--

--

Greg Perry
Greg Perry

No responses yet