pub package

meta_seo_module

module for meta_seo package

Installation

  1. If the juneflow project doesn't exist, please create it by following this guide.
  2. open terminal in the juneflow project root directory, enter the following command.
june add meta_seo_module

Usage

Normal Usage

@override
Widget build(BuildContext context) {

  // Add MetaSEO just into Web platform condition
  if(kIsWeb) {
    // Define MetaSEO object
    MetaSEO meta = MetaSEO();
    // add meta seo data for web app as you want
    meta.author(author: 'Eng Mouaz M AlShahmeh');
    meta.description(description: 'Meta SEO Web Example');
    meta.keywords(keywords: 'Flutter, Dart, SEO, Meta, Web');
  }

  return const Scaffold(
    body: Center(child: Text('Meta SEO Web Example')),
  );
}

Usage with GoRouter

final router = GoRouter(
  initialLocation: '/',
  routes: <GoRoute>[
    GoRoute(
      path: '/',
      builder: (BuildContext context, GoRouterState state) {
        // Add MetaSEO just into Web platform condition
        if(kIsWeb) {
          // Define MetaSEO object
          MetaSEO meta = MetaSEO();
          // add meta seo data for web app as you want
          meta.ogTitle(ogTitle: 'First Screen');
          meta.description(description: 'First Screen');
          meta.keywords(keywords: 'Flutter, Dart, SEO, Meta, Web');
        }

        return const FirstScreen();
      },
    ),
    GoRoute(
      path: '/second_screen',
      builder: (BuildContext context, GoRouterState state) {
        // Add MetaSEO just into Web platform condition
        if(kIsWeb) {
          // Define MetaSEO object
          MetaSEO meta = MetaSEO();
          // add meta seo data for web app as you want
          meta.ogTitle(ogTitle: 'Second Screen');
          meta.description(description: 'Second Screen');
          meta.keywords(keywords: 'Flutter, Dart, SEO, Meta, Web');
        }

        return const SecondScreen();
      },
    ),
  ],
);

Extended Usage

@override
Widget build(BuildContext context) {
  
    // Add MetaSEO just into Web platform condition
    if(kIsWeb) {
      // Define MetaSEO object
      MetaSEO meta = MetaSEO();
      // add meta seo open graph tags as you want
      meta.facebookAppID(facebookAppID: 'your_app_id');
      meta.ogTitle(ogTitle: 'Example Screen');
      meta.ogDescription(ogDescription: 'Example Screen Description');
      meta.ogImage(ogImage: 'https://example.com/example.png');

      // here you can add any tags does not exist in the package as this
      meta.propertyContent(property: 'og:site_name', content: 'example');
      
      // or if you want to add twitter card meta tags just as the following
      meta.twitterCard(twitterCard: TwitterCard.summaryLargeImage);
      meta.twitterTitle(twitterTitle: 'Example Screen');
      meta.twitterDescription(twitterDescription: 'Example Screen Description');
      meta.twitterImage(twitterImage: 'https://example.com/example.png');
    
      // here you can add any tags does not exist in the package as this
      meta.nameContent(name: 'twitter:site', content: '@mouaz_m_shahmeh');
    }
    
    return const Scaffold(
      body: Center(child: Text('Extended Meta SEO Web Example')),
    );
}