fluttergnulicensingabout-box

Flutter How do I add my GPL License to the LicensePage shown in the about dialog


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?


Solution

  • 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();
      }