1

I need to include a list of all the third party libraries I've used and thinking of just pasting all the licences into a string but I can't have a string over multiple lines in flutter.

  String licences = 'asfasdf
  asdf';

The above is an example and this shows an error: Expected to find ';'.dart(expected_token) Unterminated string literal.dart(unterminated_string_literal)

How can I achieve this so I can paste all the licences into a string?

1 Answer 1

5

You can use triple quote for multiple lines

String licences = '''asfasdf
                     asdf''';

https://api.dart.dev/stable/2.8.0/dart-core/String-class.html

Sign up to request clarification or add additional context in comments.

2 Comments

The problem with this is that the resulting string will have spaces - asfasdf asdf rather than asfasdfasdf. Is there a solution that doesn't add those spaces?
Sounds trivial but you can just remove the spaces. That makes the indentation look a bit weird but is a valid solution. To have nicer indentation you could define the string in a new file instead of in some nested place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.