flutter 사이트 접속 get started -> macOS 클릭

 

 

 

 

다운로드 후 원하는위치에 옮겨놓는다

 

 

 

 

터미널 열고 nano ~/.bash_profile 입력(절대경로로 지정할것임) (권한오류가 날때 앞에nano앞에 sudo 붙이자 )

 

 

 

 

홈피에 export PATH="$PATH:`pwd`/flutter/bin"  이렇게나와있는데 $PATH:이 뒷부분 다지우고 flutter 경로 /bin"을 입력

drag and drop하면 경로가 들어감 

입력 후 control+x 다음  y 다음 엔터 까지하면 끝 터미널 재실행 

 

 

 

flutter --version 입력하여 설치된것 확인 

반응형

'flutter' 카테고리의 다른 글

앱 이름 국제화  (0) 2024.01.28
fireabase 연동  (2) 2022.09.22
firebase export PATH="$PATH":"$HOME/.pub-cache/bin  (0) 2022.09.22

firebase 웹 배포 시 전에 프로젝트를 삭제했을 경우 

 

firebaserc already has a default project라는 에러가뜬다 

 

이럴땐 프로젝트 콘솔에서

firebase use --add 을 실행하면 프로젝트를 다시 선택할수있다 

 

참고 : https://stackoverflow.com/questions/57858029/unable-to-change-the-default-project-to-deploy-my-project-on-firebase-hosting

반응형

'flutter > web' 카테고리의 다른 글

컴퓨터상에서 배포하기  (0) 2023.05.17
web icon 변경하기  (0) 2022.03.07
flutter 2.0 web firebase hosting이용해 배포하기  (0) 2021.07.14

프로젝트르 처음만들거나 낮은버전에서 만들었을때 

 

Terminal 에서 

flutter create .  

실행 끝 

 

 

==============================================================

수동

 

flutter build web 했을때  missing index.html 에러가 날때

 

폴더 디렉토리에 web이란 폴더 생성 후

 

 

 

 file생성으로 index.html 생성하고 

 

 

아래 내용을 넣은후 실행하면 끝 (프로젝트생성시 web 선택하면 자동생성되는 html코드 title부분수정해야 링크줄때 제목 제대로 나옴)

<!DOCTYPE html>
<html>
<head>
    <!--
      If you are serving your web app in a path other than the root, change the
      href value below to reflect the base path you are serving from.

      The path provided below has to start and end with a slash "/" in order for
      it to work correctly.

      For more details:
      * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    -->
    <base href="/">

    <meta charset="UTF-8">
    <meta content="IE=Edge" http-equiv="X-UA-Compatible">
    <meta name="description" content="A new Flutter project.">

    <!-- iOS meta tags & icons -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="get_x_with_youtube">
    <link rel="apple-touch-icon" href="icons/Icon-192.png">

    <title>title</title>
    <link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
     application. For more information, see:
     https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
    var serviceWorkerVersion = null;
    var scriptLoaded = false;
    function loadMainDartJs() {
      if (scriptLoaded) {
        return;
      }
      scriptLoaded = true;
      var scriptTag = document.createElement('script');
      scriptTag.src = 'main.dart.js';
      scriptTag.type = 'application/javascript';
      document.body.append(scriptTag);
    }

    if ('serviceWorker' in navigator) {
      // Service workers are supported. Use them.
      window.addEventListener('load', function () {
        // Wait for registration to finish before dropping the <script> tag.
        // Otherwise, the browser will load the script multiple times,
        // potentially different versions.
        var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
        navigator.serviceWorker.register(serviceWorkerUrl)
          .then((reg) => {
            function waitForActivation(serviceWorker) {
              serviceWorker.addEventListener('statechange', () => {
                if (serviceWorker.state == 'activated') {
                  console.log('Installed new service worker.');
                  loadMainDartJs();
                }
              });
            }
            if (!reg.active && (reg.installing || reg.waiting)) {
              // No active web worker and we have installed or are installing
              // one for the first time. Simply wait for it to activate.
              waitForActivation(reg.installing ?? reg.waiting);
            } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
              // When the app updates the serviceWorkerVersion changes, so we
              // need to ask the service worker to update.
              console.log('New service worker available.');
              reg.update();
              waitForActivation(reg.installing);
            } else {
              // Existing service worker is still good.
              console.log('Loading app from service worker.');
              loadMainDartJs();
            }
          });

        // If service worker doesn't succeed in a reasonable amount of time,
        // fallback to plaint <script> tag.
        setTimeout(() => {
          if (!scriptLoaded) {
            console.warn(
              'Failed to load app from service worker. Falling back to plain <script> tag.',
            );
            loadMainDartJs();
          }
        }, 4000);
      });
    } else {
      // Service workers not supported. Just drop the <script> tag.
      loadMainDartJs();
    }
  </script>
</body>
</html>

 

 

반응형

+ Recent posts