0

I want to license my Flutter application under GPLv3. So I put the GPLv3 license text in the root of my project and named the file LICENSE.

I read in the docs for the LicenseRegistry class that

The flutter tool will automatically collect the contents of all the LICENSE files found at the root of each package into a single LICENSE file in the default asset bundle.

But I don't see the GPLv3 listed on LicensePage, so maybe I don't understand something. How do I get the LicensePage displayed by ShowAboutDialog to include the GPLv3 license under which I'd like to release my application?

Chris Nadovich
  • 202
  • 1
  • 7
  • You can make a monorepo by putting a tiny package containing only the GPL license file, and reference it in your pubspec as a relative local path. That might be enough to have it be processed. – Randal Schwartz Mar 01 '23 at 01:47
  • 1
    As it turns out, the license _does_ appear in the AboutDialog, merely by naming it LICENSE and putting it in the root directory of the app. It's just buried down in the deep pile of licenses, named with a name I wasn't expecting. I was expecting special treatment since it's the license for the app itself. No special treatment, but it's there. So the answer to my question is really a Doh! I didn't look hard enough. – Chris Nadovich Mar 04 '23 at 12:36

1 Answers1

1

Another approach is using the LicenceRegistry class to add in custom licences (called from initState for example).

import 'package:flutter/foundation.dart';

  @override
  void initState() {
    LicenseRegistry.addLicense(() async* {
      yield LicenseEntryWithLineBreaks(
        ["app name"], 
        "app contents", // 
      );
    });

    super.initState();
  }
Kdon
  • 892
  • 6
  • 19