Sri Lanka embattled president Gotabaya Rajapaksa has flown out of the country, heading to the neighbouring Maldives, according to local officials.