checkBaseHref function Null safety

String checkBaseHref (
  1. String? baseHref
)

Checks that baseHref is set.

Throws an exception otherwise.

Implementation

String checkBaseHref(String? baseHref) {
  if (baseHref == null) {
    throw Exception('Please add a <base> element to your index.html');
  }
  if (!baseHref.endsWith('/')) {
    throw Exception('The base href has to end with a "/" to work correctly');
  }
  return baseHref;
}