Repository: droibit/flutter_custom_tabs

Issue:
app crush on ios
```
  try {
    await launch(url);
  } catch (e) {}
```
if the String `url` has a space at the beginning, the app crushes on IOS, on android nothing happens.
- maybe trim() the string before use, incase human forgot to do so 


Discussion: @SidneyMachara   
Thanks for the report!

We'll fix it so that the app doesn't crash when opening a URL that contains whitespace.  
(The current implementation behaved somewhat strangely 😅 ).

Fix patch:
diff --git a/flutter_custom_tabs/lib/src/launcher.dart b/flutter_custom_tabs/lib/src/launcher.dart
index 20d48b6f..171fee11 100644
--- a/flutter_custom_tabs/lib/src/launcher.dart
+++ b/flutter_custom_tabs/lib/src/launcher.dart
@@ -51,7 +51,7 @@ Future<void> launch(String urlString,
   }
 
   final launch = () => CustomTabsPlatform.instance.launch(
-        urlString,
+        url.toString(),
         customTabsOption: customTabsOption,
         safariVCOption: safariVCOption,
       );


Test patch:
diff --git a/flutter_custom_tabs/test/launcher_test.dart b/flutter_custom_tabs/test/launcher_test.dart
index 97d4069e..5e335b83 100644
--- a/flutter_custom_tabs/test/launcher_test.dart
+++ b/flutter_custom_tabs/test/launcher_test.dart
@@ -95,6 +95,21 @@ void main() {
     ));
   });
 
+  test('launch: with a url containg a whitespace', () async {
+    final url = ' http://example.com/';
+    when(mock.launch(
+      any,
+      customTabsOption: anyNamed('customTabsOption'),
+      safariVCOption: anyNamed('safariVCOption'),
+    )).thenAnswer((_) async => null);
+
+    await launch(url);
+
+    verify(mock.launch(
+      url.trimLeft(),
+    ));
+  });
+
   test('statusBarBrightness: run on iOS', () async {
     when(mock.launch(
       any,