Former Republic of Ireland footballer Anthony Stokes was caught with almost €4,000 worth of cocaine in his car after leading gardai on a high-speed pursuit in Dublin, a court has heard.