{
    "componentChunkName": "component---node-modules-rocketseat-gatsby-theme-docs-core-src-templates-docs-query-js",
    "path": "/docs/flutter/initializing/",
    "result": {"data":{"mdx":{"id":"a476a827-6f52-5d01-8256-f6505032c10e","excerpt":"Read our  Getting Started Guide  to check how to add the plugin to your flutter project Sign Up and Get your Free LinkFive Api Key First  Sign up  on our…","fields":{"slug":"/docs/flutter/initializing/"},"frontmatter":{"title":"Initialize Flutter","description":"Initialize the linkfive_purchases plugin with your Api key","image":null,"disableTableOfContents":null},"body":"var _excluded = [\"components\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"title\": \"Initialize Flutter\",\n  \"description\": \"Initialize the linkfive_purchases plugin with your Api key\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"Read our \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/docs/flutter/get-started\"\n  }, \"Getting Started Guide\"), \" to check how to add the plugin to your flutter project\")), mdx(\"h2\", {\n    \"id\": \"sign-up-and-get-your-free-linkfive-api-key\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#sign-up-and-get-your-free-linkfive-api-key\",\n    \"aria-label\": \"sign up and get your free linkfive api key permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Sign Up and Get your Free LinkFive Api Key\"), mdx(\"p\", null, \"First \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://app.linkfive.io/sign-up?from=flutter_init\"\n  }, \"Sign up\"), \" on our Website. It's free!\"), mdx(\"h2\", {\n    \"id\": \"create-your-api-key\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#create-your-api-key\",\n    \"aria-label\": \"create your api key permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Create Your Api Key\"), mdx(\"p\", null, \"After logging in, select the API menu item and click on \\\"Create New Api Key\\\"\"), mdx(DocImg, {\n    img: apiKee,\n    title: \"LinkFive Create a new Api Key\",\n    mdxType: \"DocImg\"\n  }), mdx(\"p\", null, \"The api key will be generated and can be used in your project.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"You can also create multiple Api Keys for your staging app or for testing your subscriptions and can be used to filter \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/docs/dashboard/subscription-playout\"\n  }, \"Subscriptions using the Playout\"))), mdx(\"h2\", {\n    \"id\": \"initialize-the-plugin\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#initialize-the-plugin\",\n    \"aria-label\": \"initialize the plugin permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Initialize the Plugin\"), mdx(\"p\", null, \"Use the Api key and initialize the LinkFive plugin pretty early in your code. You can use any state management systems such as Provider, getX, riverpod or bloc.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-dart\"\n  }, \"// Get your API key after sign up\\nawait LinkFivePurchases.init(\\\"LinkFive Api Key\\\");\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"After calling init, the plugin will check for all active subscriptions the user already purchased and will verify the receipts using the linkfive api.\")), mdx(\"h2\", {\n    \"id\": \"initialize-the-provider-plugin\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#initialize-the-provider-plugin\",\n    \"aria-label\": \"initialize the provider plugin permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Initialize the Provider Plugin\"), mdx(\"p\", null, \"We also developed an easy to use provider plugin \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://pub.dev/packages/linkfive_purchases_provider\"\n  }, \"linkfive_purchases_provider\"), \".\"), mdx(\"p\", null, \"Just add the provider to your other providers and initialize using lazy:false to immediately check for active subscriptions.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-dart\"\n  }, \"MultiProvider(\\n  providers: [\\n    // ...\\n    ChangeNotifierProvider(\\n      create: (context) => LinkFiveProvider(\\\"API_KEY\\\"),\\n      lazy: false,\\n    ),\\n  ]\\n)\\n\")), mdx(\"p\", null, \"The Provider will now fetch all active subscriptions and can be used like any other provider using the consumer function.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-dart\"\n  }, \"Consumer<LinkFiveProvider>(\\n  builder: (_, provider, __) {\\n    return PaywallScaffold(\\n      child: SimplePaywall(\\n        callbackInterface: provider.callbackInterface,\\n        subscriptionListData: provider.getSubscriptionListData(context),\\n        // ...\\n      ));\\n  },\\n);\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"Next: \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/docs/flutter/get-all-active-subscriptions\"\n  }, \"Get All Active Subscriptions\"))));\n}\n;\nMDXContent.isMDXComponent = true;","headings":[{"depth":2,"value":"Sign Up and Get your Free LinkFive Api Key"},{"depth":2,"value":"Create Your Api Key"},{"depth":2,"value":"Initialize the Plugin"},{"depth":2,"value":"Initialize the Provider Plugin"}]}},"pageContext":{"slug":"/docs/flutter/initializing/","next":{"label":"Introduction","link":"/docs/docs/"},"repositoryEditUrl":"","repositoryProvider":""}},
    "staticQueryHashes": ["1954253342","2328931024","2501019404","973074209"]}