Remove the quotes from

 var long2 = double.parse('$group1');

to

 var long2 = double.parse($group1);

You can also use

var long2 = double.tryParse($group1);

or to also accept numbers without fractions

var long2 = num.tryParse($group1)?.toDouble();

to not get an exception when the string in $group1 can not be converted to a valid double.

Answer from Günter Zöchbauer on Stack Overflow
🌐
DhiWise
dhiwise.com › post › flutter-string-to-double-converting-data-with-precision
Flutter String to Double: A Step-by-Step Guide
April 3, 2025 - This blog will explore the different approaches to converting Flutter string to double, including using built-in methods, handling potential errors, and optimizing performance.
People also ask

What are the different methods to convert a string to a double in Flutter?
The primary methods are: - Using the double.parse() function - Using the double.tryParse() function for error handling - Using the num.parse() function for more flexibility
🌐
dhiwise.com
dhiwise.com › post › flutter-string-to-double-converting-data-with-precision
Flutter String to Double: A Step-by-Step Guide
What are some best practices for converting strings to doubles in Flutter?
- Validate user input before conversion to prevent errors. - Use appropriate error handling mechanisms to handle parsing failures gracefully. - Consider using double.tryParse() for safer conversions. - Format the output appropriately based on the context.
🌐
dhiwise.com
dhiwise.com › post › flutter-string-to-double-converting-data-with-precision
Flutter String to Double: A Step-by-Step Guide
Why is it necessary to convert strings to doubles in Flutter?
Converting strings to doubles is crucial when dealing with numerical input from users or when working with data that requires numerical calculations. It ensures that your Flutter app can process and manipulate numerical values correctly.
🌐
dhiwise.com
dhiwise.com › post › flutter-string-to-double-converting-data-with-precision
Flutter String to Double: A Step-by-Step Guide
🌐
YouTube
youtube.com › watch
Flutter - How To Convert A String into a double/int (Dart Type ...
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
FlutterFlow Community
community.flutterflow.io › database-and-apis › post › convert-the-api-response-variable-type-from-string-to-double-jk8ZbSlpEsM0miD
Convert the API response variable type from string to double
December 5, 2023 - In Bubble, when you connect to an API endpoint, it lets you map the returned values to variable types. This is what I think I am missing out on here. It seems that all data returned from API calls default to strings. I need to work with them as numbers (double) to allow for number formatting and the following expression.
🌐
Flutter
api.flutter.dev › flutter › dart-core › double › toString.html
toString method - double class - dart:core library - Dart API
For all doubles, d, converting to a string and parsing the string back gives the same value again: d == double.parse(d.toString()) (except when d is NaN). String toString(); Flutter · dart:core · double · toString abstract method ·
🌐
Medium
medium.com › @letmeflutter123 › how-to-easily-convert-flutter-string-to-double-bba00bec00e6
How To Convert Flutter String To Double | by Zeeshan Ali | Medium
August 7, 2023 - In order to implement this conversion, just follow the below steps: First we will declare a string variable and initialize it with a decimal format number string. Then we will define another variable of type double and pass double.parse(takes ...
Find elsewhere
🌐
BezKoder
bezkoder.com › home › how to parse a string into a number in dart/flutter
How to parse a String into a number in Dart/Flutter - BezKoder
April 1, 2022 - Dart convert String to double - Dart convert String to int - Dart convert Hex string to int - Dart parse String to int - Dart parse String to double
🌐
CloudHadoop
cloudhadoop.com › dart-convert-double-string
How to convert Double to String or String to double in Dart
Homes with integrated smart systems sell 17% faster than conventional properties, as buyers increasingly prioritize technology-enabled features that promise convenience, security, and energy efficiency in today's competitive real estate market.
🌐
Medium
medium.com › nextfunc › dart-flutter-how-to-parse-string-to-number-22c6e181e599
Dart/Flutter — How to parse String to number | by Phuc Tran | Nextfunc Co., Ltd | Medium
November 7, 2020 - // Change to default value if you want. return null; });/// Parse string to double double stringToDouble_parse(String input) { return double.parse(input, (error) { // Return null if input string is invalid.
🌐
Flutter
api.flutter.dev › flutter › dart-core › double › tryParse.html
tryParse method - double class - dart:core library - Dart API
var value = double.tryParse('3.14'); // 3.14 value = double.tryParse(' 3.14 \xA0'); // 3.14 value = double.tryParse('0.'); // 0.0 value = double.tryParse('.0'); // 0.0 value = double.tryParse('-1.e3'); // -1000.0 value = double.tryParse('1234E+7'); // 12340000000.0 value = double.tryParse('+.12e-9'); // 1.2e-10 value = double.tryParse('-NaN'); // NaN value = double.tryParse('0xFF'); // null value = double.tryParse(double.infinity.toString()); // Infinity · external static double? tryParse(String source); Flutter ·
🌐
Flutter Stuff
flutterstuff.com › converting-strings-to-int-or-double-in-dart-flutter-a-comprehensive-guide
Converting Strings to Int or Double in Dart/Flutter: A Comprehensive Guide - Flutter Stuff
December 9, 2024 - In this article, we will explore various ways to convert strings to integers or doubles in Dart/Flutter, including using the `num.dart` library, parsing attempts, and error handling.
🌐
Flutter
api.flutter.dev › flutter › dart-core › num › toStringAsFixed.html
toStringAsFixed method - num class - dart:core library - Dart API
A decimal-point string-representation of this number. Converts this number to a double before computing the string representation, as by toDouble.
🌐
Dart Tutorial
darttutorial.org › home › dart tutorial › dart double
Dart double
May 27, 2022 - Use double.parse() to convert a string into a double.
🌐
GitHub
github.com › flutter › flutter › issues › 73692
[PARSE][Double] Incorrect Double to String value when trying parse a long String to Double · Issue #73692 · flutter/flutter
November 10, 2020 - Hi all, Currently I am try parse a String '111222333444555666' to Double by using double.parse and double.tryParse but both of them have an result 111222333444555660 (with the zero in the end). I have try with those codes below: var data...
Author   khanhnt748